November 5, 200322 yr I am trying to create 1 script and attach it to a button that does this: In a found set of 2 records, depending on the contents of the field "Purchase #", this script needs to print the appropriate layout. If "Purchase #" is empty print layout 1, if "Purchase #" is not empty, print layout #2...that's it. I would like to do with with as little user interaction as necessary. Basically hit the button, and maybe OK to print and thats it. Similarly, if there are 10 records in the found set, I need it to print the appropriate layout. Any ideas? Thank you.
November 5, 200322 yr If you want the layout to be changed for each record in the found set and only prompt for the first record and use the initial setting for the other records in the found set: Allow User Abort [off] Go to Record/Request/Page [first] If [ IsEmpty(Purchase #) ] Go to Layout [ layout 1 ] Else Go to Layout [ layout 2 ] End If Print [] Loop Go to Record/Request/Page [next, exit after last] If [ IsEmpty(Purchase #) ] Go to Layout [ layout 1 ] Else Go to Layout [ layout 2 ] End If Print [no dialog] End Loop Each of the layouts will need to be set to form view (print only one record) and the Print step also needs to have "print current record" option selected. Otherwise a lot of paper will be wasted. Make doubly sure the "exit after last" option is selected in the last "Go to Record/Request/Page" step, otherwise you'll have an infinite loop. While testing the script, set the Allow User Abort step to [on] so you can cancel out if the loop goes infinite on you. Once it's done, change it to [off] so the user cannot cancel out of the script while it is running. You'll also need to trap for the user clicking the cancel button in the first Print [] step. I'll let you work that one out yourself.
Create an account or sign in to comment