Jump to content

Save as PDF using multiple field names


steigrafx

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

Recommended Posts

I've searched but can't find a solution to this problem.

 

I have a script that saves the current record as a pdf.  I'm using a variable called $Invoice_Number with the value

MAS_Invoices::Invoice_No & ".pdf", and this works well enough, but...

 

I would like to add a second field to the file name, MAS_Invoices::Invoice_Date, but I can't figure out the syntax.  The Invoice_Number should precede the Invoice_Date.

 

Thanks for your time and help.

 

Kevin

Link to comment
Share on other sites

MAS_Invoices::Invoice_Date & MAS_Invoices::Invoice_No & ".pdf"

 

if you want something like an underscore between the date and the invoice number, you could do: MAS_Invoices::Invoice_Date & "_" & MAS_Invoices::Invoice_No & ".pdf"

 

should do it

Martie

Link to comment
Share on other sites

Thanks for the reply, Martie.  That's exactly what I tried but it doesn't work.  Running the script on invoice number 2, I get an error saying:

"20132.pdf could not be created on this disk.  Use a different name, make more room on the disk, unlock it or use a different disk."

 

The file saves fine with the script step in my original post, for example, 2.pdf.  I'd like it to be preceded by the date, if possible.

 

Thanks,

Kevin

Link to comment
Share on other sites

That is typically a badly formed path error, Kevin. Do you set $exportPath and then use $exportPath in the Save as PDF script step?

 

Set $exportPath, Get(desktopPath) & Invoice::Date & "_" & Invoice::ID & ".pdf"

Save As PDF ($exportPath)

Link to comment
Share on other sites

Hi, bcooney.  Thanks for the reply.  No, I don't set a variable for the file path.

 

I set a variable for the file name:  $Invoice_Number = MAS Invoices::Invoice_No & ".pdf"

 

and use the variable in the Save Record as PDF, along with the full file path:  filewin:/c:/temp/$Invoice_Number

 

What you see here works perfectly.  When I add a second field to the file name variable, that's when I get the error:

MAS Invoices::Invoice_Date & MAS Invoices::Invoice_No & ".pdf"

 

Is it syntax?  Or am I just going about this the wrong way?

 

Thanks,

Kevin

Link to comment
Share on other sites

Not at a computer at the moment, but I believe you should insert &" "& between your two field names. Otherwise you end up with Table::FieldTable::Field. FM won't understand this. Nor would any other application.

Link to comment
Share on other sites

Thanks for your replies.

 

doughemi:  Yes, it is a date field, with auto-enter creation date, in the format 03/12/2013.

 

Rick:  I did as you suggested:  MAS Invoices::Invoice_Date & " " & MAS Invoices::Invoice_No & ".pdf"

but it didn't help.  I receive the same error.

 

Thanks again,

Kevin

Link to comment
Share on other sites

Yes, that must be the problem.  I substituted a text field instead of the date field, and it worked perfectly.  It's definitely the date.

 

How do I change the slashes to underscores?  Using the inspector, I changed the numeric separator to an underscore, but that didn't work.  Is there somewhere else I should be looking?

 

Sorry to be such a pain.

Link to comment
Share on other sites

Well, you did say that you were trying to write the PDFs to "and use the variable in the Save Record as PDF, along with the full file path:  filewin:/c:/temp/$Invoice_Number".

 

It is better to use FileMaker's Get (TemporaryPath), and yes this directory is purged.

 

However, why are you saving PDFs of an invoice? The record is there. Make a copy and it might not reflect the actual state of the data.

Link to comment
Share on other sites

This topic is 4085 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.