EBJ Posted July 28, 2008 Posted July 28, 2008 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
Raybaudi Posted July 28, 2008 Posted July 28, 2008 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
EBJ Posted July 28, 2008 Author Posted July 28, 2008 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
Raybaudi Posted July 29, 2008 Posted July 29, 2008 Which script step do you use to insert a .pdf into a container ? Use it.
EBJ Posted July 29, 2008 Author Posted July 29, 2008 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
Raybaudi Posted July 29, 2008 Posted July 29, 2008 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.
EBJ Posted August 8, 2008 Author Posted August 8, 2008 (edited) 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, 2008 by Guest
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now