How to copy PDF file from Image field to new record.
Hope someone already had to go through this: I'm copying records from one table to another (and then deleting them). Everything seems to be fine, except for the field image containing a PDF file. It only copies the file name but not the content. I've tried to figure it out using Importfile command, but so far, nothing.
Here's my coding:
if Contabilizar = true then
let recID := count(select 'Asientos por Registrar');
ID_Record := format(recID, "000") + 1;
let newid := ID_Record;
let x := this;
let repes := count((select 'Asientos Contabilizados')['Fecha Asiento' = x.'Fecha Asiento' and Movimiento = x.Movimiento and
number(Importe) = number(x.Importe) and
ID_Record = x.ID_Record]);
if repes = 0 then
let contab := (create 'Asientos Contabilizados');
contab.(ID_Record := x.ID_Record);
contab.('Fecha Asiento' := x.'Fecha Asiento');
contab.(Movimiento := x.Movimiento);
contab.(Importe := x.Importe);
contab.('Cuenta de Cargo' := x.'Cuenta de Cargo');
contab.('Cuenta de Abono' := x.'Cuenta de Abono');
contab.('Compras / Contratos Cesión' := x.'Compras / Contratos Cesión');
contab.(Ventas := x.Ventas);
contab.(Gastos := x.Gastos);
contab.(Inventario := x.Inventario);
contab.(Comprobante := x.Comprobante); ---> both fields are image fields of course
dialog("Contabilizar Asiento", "Asiento contabilizado correctamente!", ["OK"]);
dialog("Contabilizar Asiento", "ERROR! No se ha contabilizado este asiento", ["OK"])
dialog("Contabilizar Asiento", "Marque la casilla para contabilizar asiento", ["OK"])
Thanks for any help!!
contab.(comprobante := importFile(contab, shareFile(x.Comprobante), contab.text(id) + ".pdf"))
Sorry for the delay , I've been away for a few days.
There must be something wrong with my app or something. I've imported your DB and both buttons create a blank record.
Might be something to do with the fact that I'm working with Ninox as native app (computer based)?
Following on this thread I just wanted to share my latest attempt in case it opens the possibility for a solution.
It's clear to me that the sharefile() function is not available on the native app, but that every attached filed always has a URL. In this case, located in my local drive.
So, I began testing based on my very limited knowledge and so far I managed to extract the URL from the file in my local drive. I also tested to use that extracted URL to import the file. And it seems to work within the same record. However I can't manage to replicate that when copying it to a different table. I'm attaching again my tester DB so you can see what I came up with. I don't know if I could be on the right track or just wandering off the road out of desperation.
- 2 wk agoLast active