May 2, 20205 yr Using FM Pro 15 Advanced, and the Save/Send Records as PDF command, the resulting PDF files take on generic names. Is there a way to give these PDF files a unique name. My hope is that the file names could be generated from a field within the database.
May 2, 20205 yr Invoices: Save as PDF [Current Record] #Saves a Commercial Invoice as a pdf on the desktop. Print Setup [Orientation:Portrait; Paper size:8.5" x 11" ] [Restore; No dialog] Set Variable [$$name; Value:CUSTOMERS::Name_Full_Search & "-" & $$JobName & "¶" & Right("0" & Month(INVOICES::Date);2)&Right("0" & Day ( INVOICES::Date );2) & Right(Year(INVOICES::Date);2)] Set Variable [$Name; Value:"file:"& Get(DesktopPath)& "/" & Substitute ($$name;["/";""];[¶;" "]) & ".pdf"] Save Records as PDF [File Name:“$Name”;Current record ] [Document -] [Pages -Number Pages From:1; Include:All pages ] [Security -Printing:High Resolution; Editing:Any except extracting pages;Enable copying;Enable Screen Reader ] [Initial View -Show:Page Only; Page Layout:Single Page; Magnification:100%] [Restore; No dialog] #Delete global variables Set Variable [$$name; Value:""] Set Variable [$$JobName; Value:""] Here's one way.
May 2, 20205 yr 10 minutes ago, Steve Martino said: #Delete global variables What's the point of declaring global variables, if you need to delete them at the end of the script?? Why not simply use script variables whose scope is limited to the current script? I also don't see where you declared the $$JobName variable; if it's declared in another script, then perhaps you shouldn't be deleting it? The entire thing is confusing. 30 minutes ago, Charles Larkins said: My hope is that the file names could be generated from a field within the database. I suggest you try it this way: Set Variable [ $path; Value:Get ( DesktopPath ) & YourTable::YourField & ".pdf" ] Then in the Save Records as PDF step, enter $path as the output file: Note that your field must contain a valid file name.
May 2, 20205 yr Author Thanks for the quick replies. I'm a casual user and with that in mind I will try the second method. I think I understand how this needs to happen, will give it a try in a bit.
May 4, 20205 yr Author Well I need to brush up on my skills, it's been ten years plus since I was up on Filemaker and wrote a few elementary scripts. I spent some time with this today, and even though it looks very basic, I've not been able to get the proper results. I'll keep at it. Thanks!!!
May 4, 20205 yr Author I believe that I have the correct syntax for this, though I am not getting the expected results. My goal was to get a separate file for each record being browsed, with the name of each file being taken from the "Balance" field. Instead, I get one file with all containing all of the records with that one file is named "$path". Where have I gone wrong? Set Variable [ $Path ; Value: Get ( DesktopPath ) & ${2004 - 2005 Student Records}::Balance & ".pdf"
May 4, 20205 yr 4 minutes ago, Charles Larkins said: My goal was to get a separate file for each record being browsed, with the name of each file being taken from the "Balance" field. For this you must have your script loop over the found set and save each record individually. 9 minutes ago, Charles Larkins said: with that one file is named "$path". Make sure to NOT quote the variable name when specifying the path. --- Note that while Filemaker is quite tolerant, you are playing with fire by giving your table a name that starts with a digit. Even more importantly, it is bad practice to have a dedicated table for every year. You should have a single table for all records, with a field for the year.
May 6, 20205 yr Author I appreciate your advice concerning the naming of the table and have now renamed it. Also, when I first setup the database fifteen or so years ago, I never thought about using it year after year. For whatever reason, I cloned it each year as my teaching studio changed. I actually have a field for the year, will now use that along with just the one database. Still working on the printing issue, trying to learn more as I go along. Thanks!!!
Create an account or sign in to comment