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

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

Recommended Posts

Posted

I am trying to loop through a number of records to get all the data from one field into a single memory variable. However, as I loop through the records, they are refreshing on the layout.

More details...

Each record contains information about a stock. One piece of the data is a stock symbol. I need to get all of them into a comma separated variable.

I created a script that does this, but as it loops through the records, the layout is refreshing and it looks a little strange, to say the least. How can I keep the screen from refreshing?

Posted

I assume I am approaching this correctly? I didn't think there was any way to do this with a calculation field set as a global field?

I did find a way to get back to the record that I started on by using the Get(recordID).

Posted

Use the Freeze Window script step before the loop starts.

Also, it will be much faster if you change the view type to form instead of list. Your script can set it back to list when done.

Posted

I assume I am approaching this correctly? I didn't think there was any way to do this with a calculation field set as a global field?

I did find a way to get back to the record that I started on by using the Get(recordID).

How does that work? Do you mean get( recordNumber)?

Posted

I am trying to loop through a number of records to get all the data from one field into a single memory variable.

Hi

you do not need a loop in your script if you'll set your variable with something like this:

Set Variable [ $yourVar ; Value: CommaSeparatedFound ( YourField ) ]

where CommaSeparatedFound ( text ) is a Custom Function:


GetNthRecord ( text ; Let ( $var = $var + 1 ; $var ) ) &

Case(

$var < Get ( FoundCount ) ; "," & CommaSeparatedFound ( text ) ;

Let ( $var = "" ; "" )

)

In such way you'll not have to worry where to go back, neither the refresh issue.

You could even use the same Custom Function in a calculation field ( instead of setting a variable ), but remember to make it UNSTORED.

Posted

GetNth is a really handy function for small record sets. But it has quite poor performance. For instance, It is about 6X faster to use a standard looping script.

Example result using function above on 10,000 records: 13 seconds for CF, 2 seconds for looping script. Applescript: 2 seconds for 50,000 records.

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