Set a "script trigger" on your checkboxes and set it to "on modify"
Then your script can have a script step to set a variable for each check box
Then your script can then use a series of IF statements. IF variable_SOandSO = Yes, then go to layout variable_SOandSO, print without dialog, then move to next IF statement.
If you need an example, let me know.
Can I have multiple checkboxes in the same field, or do I need to separate them so there will be one field for each checkbox?
If I use multiple checkboxes in one field, how do I collect that information in a script?
I use “script trigger” with “on modify” and points it to my script (which is empty right now).
So yes, I really need that example of yours
With multiple values in a check box field, use the following calculation to detect whether or not a specific check box is selected:
Not IsEmpty ( FilterValues ( YourTable::YourCheckBoxField ; "Value" ) )
This expression returns True if the check box for "Value" was clicked.
Thank you PhilModJunk for your reply!
I used your example, and it helped me a bit on the way.
What happens now is that in the exact same moment I click on a checkbox the script triggers and the layout prints. And that is not quite what I want.
What I need is to be able to select all the layouts to print and THEN run the script.
The result I want is:
I mark checkbox 1 and 2 but not 3. Click the print button, the script runs and layout 1 & 2 prints.
I found the problem. It was my script trigger (of course) that made the script run when I checked a checkbox. So removing the script trigger made everything work exactly as I want it to!
Thank you all!
Magnus, Your question reflects exactly what I'm looking to do, but with 5 checkboxes in a single field. I'm confused about the specific steps needed to set that up. Can you assist?
So far, I have created a single, checkbox field called PRINT FORMS that draws its contents from a value list of the same name, set to "Use Custom Values" of Layout 1, Layout 2, etc.). This gives me a single field with the multiple checkbox items I need. My questions are:
A) Should I denote the PRINT FORMS field as a Text field or as a Calculation?
B) Where does Phil's calculation from Dec 10/14 go?
C) When I use Phil's calculation, do I need to use AND or OR, or some other modifiers between the various values
eg, Not IsEmpty ( FilterValues ( YourTable::YourCheckBoxField ; "Layout1" "Layout2" "Layout3" ) )
or do I need multiple versions of that statement
eg Not IsEmpty ( FilterValues ( YourTable::YourCheckBoxField ; "Layout1" ) ), Not IsEmpty ( FilterValues ( YourTable::YourCheckBoxField ; "Layout2") ), Not IsEmpty ( FilterValues ( YourTable::YourCheckBoxField ; "Layout3" ) )?
Thanks & I hope I can follow up with any additional questions I have about this.
A) you can't set up a calculation field with a check box format and then be able to modify it by clicking check boxes. This check box field should be a field of type text.
B) you would set up a Script with a series of IF blocks, each of which specifically tests for a different value that might be selected by clicking a check box:
If [ IsEmpty ( FilterValues ( YourTable::YourCheckBoxField ; "Layout1" ) ]
Go to Layout [ "Layout 1" (Layout 1)]
Additional code to print goes here (steps here can very with design of your database)
GO to layout [ original layout]
If [ IsEmpty ( FilterValues ( YourTable::YourCheckBoxField ; "Layout 2" ) ]
and so forth...
C ) see answer for B
PhilModJunk is right.
Your filed containing checkboxes should be a text field.
All I did was this:
a) Create a text field containing checkboxes and pick values from a value list (Layout1, Layout2…). Just as you describe.
b) Create a script that will look like this:
If [not IsEmpty ( FilterValues (YourTable::YourCheckBoXField ; “Layout1”) )]
Go to Layout [“Layout1” (FileMakerFileName)]
That’s pretty much what PhilModJunk said, but I have a “not” in the beginning of the If-command.
What the script does is to check if a checkbox is checked or not.
If it is, it will go to that layout and print, and then next selected layout and then print and so on.
I added custom dialog box in the beginning of the script asking the user if he/she really want to print. If they select no, the script will be aborted.
My mistake there, There needs to be Not IsEmpty inside each IF step. left out the Not by mistake.
I will also note that if your value list contains exactly the same text as what you used to name each layout, there's a simpler looping script that might be used with the GetValue function inside a Goto Layout, Calculation by name step but only if you can do the exact same script steps for printing every layout, which is not always possible as setting up a particular layout for printing may require more steps than just a Print step.
Thanks to both of you. I really appreciated the very specific replies. The concept is actually pretty simple, but I wouldn't have come up with the Not IsEmpty FilterValues syntax myself.