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

Odd one - loop thru found set works in debugger only


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

Recommended Posts

Posted

The below script will only work as expected in the debugger. The found set of 20 records has 5 unique CaseIds and the $caseList variable in the debugger gets populated with all 5. But if I run it outside the debugger then it only has 1 caseID in it. And I do make sure after each run to redo the find. So I am at a loss to why it would work differently in a debugger.

I thought that one could iterate and move thru a found sets records with no issues.

Go to Layout [ “MERGE_Contract” (FeesRecission) ]

// Freeze Window

Go to Record/Request/Page [ First ]

Sort Records [ Specified Sort Order: Cases::Case_ID; ascending ] [ Restore; No dialog ]

Set Variable [ $prevCaseID; Value:-1 ]

# Iterate thru found set collecting the CaseIDs for generate loop

Loop

If [ $prevCaseID not equal Cases::Case_ID ]

Set Variable [ $prevCaseID; Value:Cases::Case_ID ]

Set Variable [ $caseList; Value:$caseList & ¶ & $prevCaseID ]

End If

Go to Record/Request/Page [ Next; Exit after last ]

End Loop

# Iterate thru CaseIDs and call the generate script on each

Set Variable [ $listCount; Value:ValueCount ( $caseList ) ]

Set Variable [ $i; Value:1 ]

Loop

Set Variable [ $i; Value:$i + 1 ]

Exit Loop If [ $i > $listCount ]

# Set the current result item from query into variables

Set Variable [ $caseItem; Value:GetValue ( $caseList ; $i) ]

Show All Records

Freeze Window

Enter Find Mode [ ]

Set Field [ Cases::Case_ID; $caseItem ]

Perform Find [ ]

Perform Script [ “TestExport4” ]

End Loop

Show Custom Dialog [ Title: "im done"; Message: "generated " & $listCount; Buttons: “OK”, “Cancel” ]

Posted

Looks like go to first record is out of place

Current:

Go to Layout [ “MERGE_Contract” (FeesRecission) ]

// Freeze Window

Go to Record/Request/Page [ First ]

Sort Records [ Specified Sort Order: Cases::Case_ID; ascending ] [ Restore; No dialog ]

Should be:

Enter Browse Mode

Commit Records

Go to Layout [ “MERGE_Contract” (FeesRecission) ]

// Freeze Window

Sort Records [ Specified Sort Order: Cases::Case_ID; ascending ] [ Restore; No dialog ]

Go to Record/Request/Page [ First ]

Posted

Thank you, Thank you so much! That worked.

The completely makes sense and needed some fresh eyes. Won't make this mistake again.

However, isn't it odd that it worked when I stepped thru the code in the debugger, thats what thru me.

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