Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7853 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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.

Posted

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

Posted

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

This topic is 7853 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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