FileMaker Tip of the Day.
Quite often when creating printed layouts, you need to have layout objects that change according to some specific set of circumstances. This means in FileMaker Pro that you need to create a calculation field that you then put on the layout. I’m sure most FileMaker developers have done this sort of thing many times already.
But did you know that layout objects can be calculated from script parameters, not just from field data?
An example : I have a layout that I want to print to pdf and to a printer. But there are some objects that I want only to print when going to a pdf, and not to a printer. I have a script that I run that goes to the layout, does a page setup and preview[pause] and then goes back to where it started. I added a calculation to the file that is essentially the following :
Case ( Get ( ScriptParameter ) = “PDF” ; “PDF Only Text” )
The field is unstored and set to evaluate always. All I need to do is pass “PDF” to my print script, and it will change dynamically without ever having to set a field or global variable.
To take this to it’s ( illogical ) extreme, imagine you have a function to have multiple named parameters in a single script parameter. Your entire print layout could be set at script call time, as opposed to from stored field data. Obviously that’s not realistic, but with a little thought, I’m sure there are plenty of ways you could use this.
I’ll post an example the Custom Functions we use for multiple named parameters in another post.