You would haev to have a script that checks to see if a selection was made and then goes to each layout to print. I would use a global text field for the selection field so that it wont effect multiple users.
If [ PatternCount ( gSelection; "Estimate" ) ]
Go to Layout [ "Estimate" ]
If [ PatternCount ( gSelection; "Delivery order " ) ]
Go to Layout [ "Delivery order " ]
Do you want the user to be able to make multiple selections and then see them printed?
If so, make it a check box field. (The field should be a text field with global storage selected in storage options.)
Add a button next to the check boxes to do the printing.
In your script:
Create something like this:
If [PatternCount(tablename::CheckboxField, "Estimate") > 0 ]
//Do steps to print the estimate.
If [PatternCount(tablename::checkboxfield, "Delivery Order") > 0]
//Do steps to print the delivery order
//Add an If - End If block for each item in your check box field.
Note that I'm using PatternCount (filtervalues can also be used with slightly different syntax.) because a check box field will store each option in a carriage return separated list where the order stored matches the order in which the user clicked the check boxes.
Hi PhilModJ, 'm a beginner in FM developing. Can you explain/elaborate further on the following:
a) //Do steps to print the estimate.
b) //Add an If - End If block for each item in your check box field.c) I dun understand about your comments on "PatternCount (filtervalues can also be used with slightly different syntax.) because a check box field will store each option in a carriage return separated list where the order stored matches the order in which the user clicked the check boxes."
Thanks Mr Vodka,.. from your script, how can I print w/o going to the specified layout?
I didnt add the print step because I thought it was self evident. But basically, after each layout you would probably use a print setup and then print. You can surpress teh dialog so that you you do not see the options to choose for your end users if you wish. You can start the script with Freeze window as well so that it reduces teh flashing.
Not sure what you mean by w/o changing layouts... How you you print different layouts without going to them first?
Oh i see... roger that,.. thanks... cos i was thinking maybe its possible to print eg. estimate without going to the estimate layout but just activate it in the Job Overview layout.
No worries, I understand your point... thanks a mil Mr Vodka
Can you explain/elaborate further on the following:
a) //Do steps to print the estimate.
Mr Vodka and I are giving you the same basic solution. He indicated that you need to go to the layout in order to print it. I left a general statement here as I don't know the structure of your database. In place of "//Do steps to print the estimate. "
You might have:
Go to layout [Estimate (estimate)]
Perform find [restore]
Sort [No dialog; restore]
Go To Layout [original layout]
You might have a slightly different set of steps, (the find and sort steps may not be necessary or you want to use a different approach to finding your records or use Go To Related Record. You might want to simply preview the report and pause so that the user can use the print setup and print dialogs in the file menu to print the report with the options and printer that they choose. Since I don't know enough about your database to spell this out in detail, I inserted a general placeholder for you to fill out with the details you need.
b) //Add an If - End If block for each item in your check box field.
If you look at the original script I have steps that start with "If" and end with "End If". That's what I'm calling an "If-End If block". I didn't supply code for every single value in your check box list. You'd need to add additional steps in the same pattern but edit the "Pattern count" expression to refer to each of the remaining values in turn.
c) I don't understand about your comments on "PatternCount"
Here's a useful thing I recommend to new users when they are trying to figure out how a check box field works: Make a copy of a check box formatted field. Make it the same size, but remove the check box format so that it's just an edit box. Place it next to the check box field. Now start clicking check boxes. You can see what's actually being stored in the field by watching what appears in the unformatted copy of the field. If you do that, you should be able to follow what I said about using patterncount.
Thanks PhilModJ for your comprehensive replies... will give it a shot and see how it works... you guys are good!