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.
Juggernaut

Loop based on a field that has a value list.

Featured Replies

How do you create a loop where the loop is based on a value list. What I'm trying to do is create a script where I perform a search based on each of the values in a value list that is assigned to a specific field.

For example, suppose you have a field with a value list assigned to it of value 1, value 2, value 3 and so forth. Then in my script I need to perform a search on value 1 then export the results. Then loop again to perform a search on value 2 then export the results, then loop again to value 3 until all values have been searched for.

Thanks.

Create 2 new fields:

MarkForExport (text field)

g_ValueListSearch (global text field)

Then run this script (make sure you're on a layout containing the MarkForExport and ValueListField fields)

Set Error Capture [On]

Show All Records

Replace [MarkForExport,"No"] [No Dialog]

Loop

. Enter Find Mode []

. Set Field [MarkForExport,"No"]

. Perform Find []

. Exit Loop If [status(CurrentFoundCount) = 0]

. Set Field [g_ValueListSearch, ValueListField]

. Enter Find Mode []

. Set Field [ValueListField, "==" & g_ValueListSearch]

. Perform Find []

. # Sort, summarise etc for your export routine

. Export Records (whatever your requirements are for naming file setc)

. Replace [MarkForExport,"Yes"] [No Dialog]

End Loop

This will find all records for a particular conetns of the value list field, export them, then mark them as having been exported. It then loops back to the next record which hasn't been exported yet, finds all that match, etc , etc

  • Author

Will this work with fields that are formatted using checkboxes?

Can you explain to me what this line is doing

Set Field [ValueListField, "==" & g_ValueListSearch]

Cause I tried this using checkboxes and my results found seem to be wrong. I always get the same found record exported on each iteration.

The search that I need to perform is if I search for value 1 records 1 through 10 will show then when I search for value 2 records 4-7 will show and the next loop if I search for value 3 records 2, 3,4, 10 will show.

Using the markforexport will obviously eliminate records that can potentially show on next iteration of the loop search.

Thanks

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.