Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.
 

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.

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:

image.png.11cfa033c8d2721b78b63c064878caf3.png

Note that your field must contain a valid file name.

 

 

  • 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.

 

 

  • 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!!!

  • 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"

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. 

 

  • 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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.