May 28, 200322 yr 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.
May 28, 200322 yr 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
May 28, 200322 yr 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