Baylah Posted May 27, 2004 Posted May 27, 2004 Is there a way I can script/calculate for conditional printing? Basically what I want to do is look into 4 individual fields on a given layout and if those fields are populted I then want them to goto a specific layout and print that layout. I ultimately want to ad this script/calcualtion to the end of an alredy fairly involved printing script. Is it possible to use and if/then calculation or will this have to be done with looping which is a concept I really don't understand very well yeet. Thanks for your help...I can be reched of forum at [email protected]. Thanks, Steve Freeman
dbruggmann Posted May 27, 2004 Posted May 27, 2004 It depends: If there's only one record to print eventually every time, you don't need a looping script. But otherwise the only way to avoid the looping script, is to find ALL the records with valid field contents BEFORE the print command. This means your existing printing script would have to call at the end a new script, which first searches for all records where these four fields aren't empty, goes to the correct layout and ptints them. But the looping concept isn't that hard. Try: Show all records Loop If {"not IsEmpty (field1) AND not IsEmpty (field2) AND not IsEmpty (field3) AND not IsEmpty (field4)"} Go to layout {YourPrintingLayout} Print {} End If Go to record {Next, Exit after last} End Loop In any case I would suggest, that you handle this in its own script. So you can fiddle around with it until you have the result perfect. And then you call the new script at the end of the printing script with the "Perform script" step.
Baylah Posted May 27, 2004 Author Posted May 27, 2004 Thank you for your help. I can't tell you how much I appreciate it. Below is my current print script, it is pretty straight forward. Go to Layout ["Order Input"] Go to Field [billing Number"] Copy [select] Enter Find Mode [] Go to Field ["Billing Number"] Paste [select] Perform Find [Replace Found Set] Goto Layout [Production Order] Print Setup [Restore, No Dialog] Print [No Dialog] Goto Layout ["Order Input"] Toggle Window [Zoom] The functionality I need to add is that after it does the first part of the print job I then need it to look at the 4 fields in question on the "order Input layout, and IF the field is popultated then print the appropriate layout. I understand the looping statement you presented, I only statethe above because I do not understand sure why the "show all records" would be called. Thanks again for your help. If I can somehow return the favor please let me know. Thanks, Steve
Baylah Posted May 27, 2004 Author Posted May 27, 2004 Does the "not" statement in front of "is empty" reverse the condition allowing the DB to look for a field that is populated versus unpopulated? If so that is a critical bit of functionality I never knew before. Thanks again, Steve
-Queue- Posted May 27, 2004 Posted May 27, 2004 Yes, not 'inverts' the results of any calculation. So not IsEmpty(field) returns true for a field with data, and not not IsEmpty(field) is redundant for IsEmpty(field). Not not can be useful for turning calculations that return integers greater than 1 into booleans, such as not not PatternCount(field, "A"), which returns 1 if the field contains "A", instead of the number of times "A" is present in the field. Note also that you could use Length(field) instead of not IsEmpty(field) in most instances, as long as you're just testing whether the field contains a value.
Baylah Posted May 27, 2004 Author Posted May 27, 2004 Thank you, again. I thought of another piece of the puzzle I am going to try and figure out for myself but I might be begging for help again. Thanks again, Steve
Baylah Posted May 27, 2004 Author Posted May 27, 2004 Hi, Well, because of functionality concerns I had to try to get fancy and what I have done doesn't work. I know I have already asked alot, but can you look at the following and tell me why it does not work? There are 4 fields that need to be examined and then if the field is populated it goes to the proper layout and then prints the page. What I have here works in that it goes to the proper pages and prints, but....It also prints the pages where the field is empty/unpopultated. It seems like it is not accepting the "not IsEmpty Condition" Loop Go to Layout ["Order Input"] If[""notIsEmpty (design#1)""] Go to Layout ["Production Checklist"] Print [No Dialog] End If If[""notIsEmpty (design#2)""] Go to Layout ["Production Checklist2"] Print [No Dialog] End If If[""notIsEmpty (design#3)""] Go to Layout ["Production Checklist3"] Print [No Dialog] End If If[""notIsEmpty (design#3)""] Go to Layout ["Production Checklist3"] Print [No Dialog] End If If[""notIsEmpty (design#4)""] Go to Layout ["Production Checklist4"] Print [No Dialog] End If Go to Record/Request/Page [Exit after last, Next] End Loop Go to Layout [Original Layout] I could not think of a way to make it work the way you originally showed me the if statement. It is crucial that I be able to print the Production layout that matches the "design #" field. Thanks, I owe you a frosty cold Beer or soft drink of your choice! Steve
Baylah Posted May 28, 2004 Author Posted May 28, 2004 I can't get this to work!!! Arghhhhhh......Any help? I can;t seem to get the script to get past the first if statement. I have tried as 4 individual scripts and then tying together as 4 perform scripts in a master script. I must be missing something basic. Thanks, Steve
dbruggmann Posted May 28, 2004 Posted May 28, 2004 Maybe there are the spaces missing between "not" and "IsEmpty()"?
Baylah Posted May 28, 2004 Author Posted May 28, 2004 hoooooooooooray! I figured it out! It never ceases to amaze me how versatile FMP is. And relatively easy for dummies like me. What is the advantage to Access? Steve
Recommended Posts
This topic is 7476 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