Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Print Different Layout based on field contents

Featured Replies

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.

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. wink.gif

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.