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.

PDF save directory - is this possible

Featured Replies

being able to specify the directory pathway for saving a PDF document and having it automatically given a unique file name based on one or several fields of data in FMP

Are you still on FM6? If so then no. If you are on a newer version then you can create the path in the variable then export out the variable path.

  • Author

No I am now on filemaker 10, so how would this work?

Say I run a report for a certain artist and I want it to save into that artists directory on the server with the artists name and the date in the filename, is that possible?

First you should change your FileMaker version in your account settings under the 'FileMaker Questions' section.

Second, you can try this.


Set Variable [ $path; Value:"filewin:/C:/" & YourArtist & "/" ]

Set Variable [ $file; Value:YourArtist & "_" & Substitute ( GetAsText ( Get ( CurrentDate ) ); "/"; "-" ) & ".pdf" ]

Set Variable [ $fullpath; Value:$path & $file ]

Save Records as PDF [ File Name: $fullpath; Current record ]

*Edit - added substitute function to swap out forward slashes in date.

Edited by Guest
added substitute function

P.S. Your directory named with your Artist will have to exist already. If it does not, then you will have to use a command line command (or you can use a plugin MooPlugin is free) to create the doc path for you.

  • 3 weeks later...

I have a slightly different version of this question. I use a dialog box for the user to enter the PDF's file name, but I need a way for them to select the Save To directory. All the solutions I've see involve the user clicking on a file to get the directory path, but since my users they will type in the PDFs name in the dialog box clicking on a file in the save to directory is confusing. They also need the ability to create directory if it doesn't exist.

Any suggestions? This is for a FMP 9 Windows platform so Apple Script and triggers are out.

Thanks,

Will

As my previous post said, you are probably better off using this free plugin

http://mooplug.com/features

  • 2 months later...

Hi

Do you have to do a similar thing if you just want the current date to be automatically included in the PDF filename?

cheers

But ... $file; Value:YourArtist & GetAsText ( Get ( CurrentDate) ) & ".pdf" ]

... unless I'm mistaken and I frequently am, Windows does not like frontslash in the file name. You might want to make it 20090504, for example.

UPDATE: How rude of me ... if you wish 20090504 format, you could use this for the file name:

Let (

today = Get ( CurrentDate ) ;

Year (today ) & Right ( "00" & Month ( today ) ; 2 ) & Right ( "00" & Day ( today ) ; 2 )

)

& ".pdf"

There are many other ways to write the date in text format as well, this is just one example.

Edited by Guest
Added update

You are absolutely correct. I had not thought about when dates are entered with slashes. ???

I modified the post to accommodate for the forward slash.

Thanks for finding it and point it out! ???

Hi,

I've worked out how to put the current date into the PDF file name with and without hyphens, but is it possible for me to get it into the following format: DDMMYY (australian date format but with last 2 digits of year only).

If I try to use RightValues( year ; 2) it doesn't seem to work...

You need to use Right() and not RightValues() but here's another alternate method:

SerialIncrement ( "00" ; Day (date ) ) &

SerialIncrement ( "00" ; Month (date ) ) &

Right ( Year ( date ) ; 2 )

Edited by Guest

Thanks so much for your help, all of that worked perfectly!! If the name field contains the name John Smith, is it possible to just have the initials "JS" picked out? or am I pushing it too much

thanking you in advance

You can format the pdf name any way you wish. I don't know how you are pulling the name but it would be something like:

Left ( NameField ; 1 ) & RightWords ( Left ( NameField ; 1 ) ; 1 )

... if the Name field contains John Smith. But your name field should have LastName and FirstName in separate fields.

Hi

RightWords(Left(NameField ; 1 ) ; 1)

returns the first letter of the first/left word "J" for some reason. Not sure why, maybe it gets confused.

Not sure why, maybe it gets confused.

Nope. I broke one of my own rules ... ALWAYS create a test instead of responding because we all can be a bit side-tracked or in a rush and can thus make a mistake. And I did.

Of course it should be:

Left ( RightWords( NameField ; 1 ) ; 1)

I apologize for being sloppy and in a hurry.

UPDATE: Keep in mind that, if the person's name is Bill Smith, Jr. it will break. This is another reason each part of the name should be in its own field.

Edited by Guest
Added update

That's so weird, I thought I had tried to reverse it and couldn't get it to work, but I copied yours and it worked perfectly. Thanks so much LaRetta and to Vodka!

When filemaker works it really is a thing of beauty and I've copied what I did

"Record Royalty Report - " & Left ( Writer1; 1 ) & Left ( RightWords( Writer1 ; 1 ) ; 1) & " - " & SerialIncrement ("00" ; Day (PeriodEnding )) & SerialIncrement ("00" ; Month(PeriodEnding )) & Right (PeriodEnding ; 2 ) & ".pdf"

A small thing but I would be negligent not to mention it:

Right (PeriodEnding ; 2 ) & ".pdf"

I see you have bypassed using the Year() function as Right ( Year ( PeriodEnding ) 2 ).

Just keep in mind that, whenever you remove FM's ability to recognize which part of the date is month, day or year, you run the risk that your text calculation might break if you change your system format. Rare in the case of the year, but I want you to be aware of it.

I am not an expert on interpretation of date settings at the OS level but I would err on the side of safe whenever possible.

Ah ok, I will change it now. Thanks LaRetta :

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.