Jump to content
Server Maintenance This Week. ×

Perform Find, then Extend Found Set inside a loop?


ken_s2007

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

Recommended Posts

I want to create a found set based on a (return-delimited) list that I paste into a global text field, i.e.,

 

Mary

Fred

Joe

 

I've got something that works; I'm wondering if doing a Perform Find prior to the loop, then using Extend Found Set in the loop is typical. It works. I just end up with (possibly a few) lines of redundant code:

#Get the number of values in the global field:
Set Variable [ $valueCount; Value:ValueCount ( Create found set from a list of values::gValues ) ]

Set Variable [ $incrementer; Value:1 ]

Set Variable [ $value; Value:"=" & """ & GetValue ( Create found set from a list of values::gValues ; $incrementer ) & """ ]

Perform Find [ Specified Find Requests: Find Records; Criteria: Create found set from a list of values::database_num: “$value” ] [ Restore ]

Loop
  Set Variable [ $value; Value:"=" & """ & GetValue ( Create found set from a list of values::gValues ; $incrementer ) & """ ]
  Extend Found Set [ Specified Find Requests: Find Records; Criteria: Create found set from a list of values::database_num: “$value” ] [ Restore ]
  Set Variable [ $incrementer; Value:$incrementer + 1 ]
  Exit Loop If [ $incrementer = $valueCount +1 ]
End Loop

Also, I'm using $valueCount to get the number of values in the global text field, but I think if I had a value like: "Mary Smith", and possibly blank lines between lines with data, the script wouldn't work as expected. I need to look further into that. thanks

Link to comment
Share on other sites

This topic is 4091 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.