July 28, 200817 yr I have a layout that creates an invoice. I wish to save a copy of the invoice as a pdf into a repeating container field. Although Filemaker provides the "Last(field)", this returns the last non-blank repetition, whereas I require the first blank repetition. At my wits end over this one. Any guidance would be most appreciated. Eric
July 28, 200817 yr Hi try this script: Set Variable [ $rep ; Value: 1 ] Loop If [ not IsEmpty ( repeatingField[$rep] ) ] Set Variable [ $rep ; Value: $rep + 1 ] Exit Loop If [ $rep > GetAsNumber ( FieldRepetitions ( Get ( FileName ) ; Get ( LayoutName ) ; "repeatingField" ) ) ] Else Save Records as PDF [ Restore; No dialog; "a.pdf"; Current record ] Go to Field [ repeatingField[$rep] ] Insert Object [ "a.pdf" ] Commit Records/Requests [ ] Exit Script [ ] End If End Loop
July 28, 200817 yr Author Hi Raybaudi Thanks for the script. I was some distance from figuring it out myself. I'm unsure about the "Insert Object" line as I am on the Mac platform, and I believe it's for Windows. Any ideas for alternatives please? Eric
July 29, 200817 yr Author Hi The "Insert File" step worked a treat. I had tested it on a local database and it was successful. Whenever I use the script on a remote database, it doesn't automatically find the a.pdf to insert it into the container, forcing me to manually locate it. Do you think it's something I have to live with? Eric
July 29, 200817 yr a.pdf was only an example ! At the top of the script, set a variabile ( $path ) with the exact path and name of the file you want. After that, you have to substitute "a.pdf" with $path in the remaining script steps. BTW: I don't think that it is a good idea to store those PDF into a file of FileMaker, neither to store them into a repeating field. For me it is better to store only a reference to the pdf ( each named dinamically by the $path ) into a normal container field of the Invoice table.
August 8, 200817 yr Author Hi again raybaudi Meant to thank you earlier for your suggestion. It worked. The reason why I had opted for a repeating container file was for neatness. I also wish to store delivery notes printed and I thought it was a good idea to retain them as a reference to the original file that should be held on the server. Anyway, thanks again from Scotland. Edited August 8, 200817 yr by Guest
Create an account or sign in to comment