0

Changing an imagefield

Dear all

I have a membership database where shooters obtain a certain licenscard, when they have had a kind of education.

for this purpose I have a choice field with the different licensetypes an dependent of an update to another card I have a trigger after update which should print and save the new license card, which I after that send via email to them.

The problem is that the image field I have for the attachment to the mail do not get changed with the new license card, so I tried to first null the image field and then tried to save the new attachment - but it seems that neither null nor "" nor 0 works so it always send the old license card to the receiver.

Can anybody help me here - attach is th script int the update field, and maybe I do something wrong here. The image field is called "Licensattach"

let myFilename := "";

switch 'Hvilket Licenskort har vedkommende' do

case 1:

(myFilename := "Provisional")

case 2:

(myFilename := "A Licens IPSC")

case 3:

(myFilename := "A+ Licens IPSC")

case 4:

(myFilename := "NROI + RO-steel")

case 5:

(myFilename := "B Licens")

case 6:

(myFilename := "NROI Range Officer")

case 7:

(myFilename := "NROI Range Officer Instructor")

case 9:

(myFilename := "NROI CRO Instructor")

case 10:

(myFilename := "NROI RM Instructor")

case 11:

(myFilename := "NROI Range Officer (Provisional)")

case 12:

(myFilename := "NROI RO-steel")

case 13:

(myFilename := "ActionAir")

default:

" intet valgt"

end;

Licensattach := null;

let title := "Udskriv Licenskort"; 

let message := "du har opdateret licenskortet - vil du sende nyt licenskort til den angivne emailadresse ?";

let answerOptions := ["JA, SEND.", "NEJ! JEG HAR ANDRE FELTER DER SKAL OPDATERES"];

if dialog(title, message, answerOptions) = "JA, SEND." then

         let xmedlem := "Vedlagt dit seneste Licenskort for medlemsnummer : "+Medlemsnr;

         Licensattach := importFile(this, printAndSaveRecord(this, myFilename), "Licenskort.pdf");

end;

sendEmail({

from: "henrik@lerfeldt.dk",

to: Email,

subject: "Nyt Licenskort",

text: xmedlem,

html: "",

attachments: Licensattach

})

 

Hope you can help me here.

Regards

Leo

2 replies

null
    • Fred
    • 3 days ago
    • Reported - view

    To clear out an image field is a two step process:

    removeFile(Image);
    Image := null
    
      • Leo_Woer
      • yesterday
      • Reported - view

      Thanks a lot that helped