MartinaL Posted February 6, 2009 Posted February 6, 2009 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
mr_vodka Posted February 6, 2009 Posted February 6, 2009 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.
MartinaL Posted February 6, 2009 Author Posted February 6, 2009 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?
mr_vodka Posted February 6, 2009 Posted February 6, 2009 (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 May 5, 2009 by Guest added substitute function
mr_vodka Posted February 6, 2009 Posted February 6, 2009 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.
Will B. Posted February 25, 2009 Posted February 25, 2009 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
mr_vodka Posted February 25, 2009 Posted February 25, 2009 As my previous post said, you are probably better off using this free plugin http://mooplug.com/features
christoff Posted May 5, 2009 Posted May 5, 2009 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
LaRetta Posted May 5, 2009 Posted May 5, 2009 (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 May 5, 2009 by Guest Added update
mr_vodka Posted May 5, 2009 Posted May 5, 2009 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! ???
christoff Posted May 8, 2009 Posted May 8, 2009 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...
LaRetta Posted May 8, 2009 Posted May 8, 2009 (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 May 8, 2009 by Guest
christoff Posted May 11, 2009 Posted May 11, 2009 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
LaRetta Posted May 11, 2009 Posted May 11, 2009 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.
christoff Posted May 12, 2009 Posted May 12, 2009 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.
LaRetta Posted May 12, 2009 Posted May 12, 2009 (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 May 12, 2009 by Guest Added update
christoff Posted May 12, 2009 Posted May 12, 2009 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"
LaRetta Posted May 12, 2009 Posted May 12, 2009 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now