Jump to content

Auto Adding Info to a record being saved as a pdf.


This topic is 1373 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

Hello all,

I have a button setup to print as a pdf. What I want to do is: When that button is pressed, the save dialogue box will already have the serial number and date added to the filename from the serial number and date field for that particular record..

Any ideas how this can be achieved?

Will it require a script?

Thank-you in advance for your help.

Kind Regards.

Andy

Link to comment
Share on other sites

What you would do is create a script.

Start by setting a variable $path to:

Get(DesktopPath) & Table::SerialNumber & "_" &  Table::YYYYMMDD & ".pdf"

YYYYMMDD is a field that calculates a date in to the above format - you will need to sanitize your file name to avoid illegal characters. (no slashes) 

then you perform step Save Records as PDF passing in the variable $path adjust any additional settings for the script step (Recommend you use create Folders on" this way if you want to create a folder you can just add it to the path in front of the serial number.

You will find a PDF on your desktop

Link to comment
Share on other sites

  • Newbies

Hiya Ocean,

Thanks ever so for the reply. I've just realised.... based on your info, this looks a lot more complicated than I initially thought. I was thinking I could just write a line using the actual field info on my database in a script:

Get C:\Users\andrew.palmer\Desktop & Table: :Serial1 & "_" &  Table: :Date & ".pdf"

Where Serial1 is one field and Date is the other field in my database.

 

I may have to ask around for a step by step guide.

I was only ever used to FMpro 9 and no scripting. Ha ha.

 

Thanks & Kind Regards

Link to comment
Share on other sites

Use this:

Get(DesktopPath) & Table::Serial1 & "_" & Substitute ( Table::Date ; "/" ; "_" ) & ".pdf

The Function Get(DesktopPath) will resolve the path for you. I wrapped the date in a substitute to convert slashes to underscores.

Link to comment
Share on other sites

This topic is 1373 days old. Please don't post here. Open a new topic instead.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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