Jump to content

PDF save directory - is this possible


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

Recommended Posts

Posted

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

Posted

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.

Posted

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?

Posted (edited)

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
Posted

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

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

Posted

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

http://mooplug.com/features

  • 2 months later...
Posted

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

Posted

See the script in my second post.

Posted (edited)

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
Posted

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

Posted

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

Posted (edited)

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
Posted

not RightValues (), you want Right ()

Posted

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

Posted

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.

Posted

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.

Posted (edited)

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
Posted

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"

Posted

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.

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