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

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

Recommended Posts

  • Newbies
Posted

Attempting to loop through found set and change status. I don't know get(last error) code that signifies no more records in found set and to break out of loop. Any help appreciated.

loopcode.gif

Posted

If I am understanding your situation correctly, you only need to check the box for "Exit after last" on the script step Go to Record/Request/Page[Next].

It should read

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

when that box is checked.

Posted

If you find it convenient to avoid looping over the records at all, there is a script step that can set the value of the field for all of the records in the current found set.

Replace Field Contents[No dialog; SHOES::status_shoe; "Pending Insert"]

can be used instead of the entire Loop ... End Loop sequence.

Posted (edited)

Two thoughts:

1. Looping thru records allows you to trap for record lock. Very important for status changes. You may consider using Todd Geist's transaction technique (http://www.geistinteractive.com/content/inventory-transactions). That is, edit the records in a portal, and when you commit the parent, all children are committed. If you cannot, then you can rollback all edits.

2. I cringe when I see words for Status. I feel it is better to have a flag field, flag_IsPendingInsert that equals 1 if this is the status. Calc the words using case statements. Users like to change words, and then the data integrity is challenged.

Edited by Guest
Posted

Your script needs a few things.

try this

jedupree

Show Custom Dialog [ Title: "Shoe Change Status"; Message: "Be Very Careful"; Buttons: “OK”, “Cancel” ] 

If [ Get ( LastMessageChoice ) = 1 ]

     Perform Find [ Specified Find Requests: Find Records; Criteria: Status::Order: “=” ] [ Restore ]

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

     Go to Record/Request/Page

          [ First ] 

Loop

     Set Field [ Status::Status Shoe; "Pending Insert" ]

     Go to Record/Request/Page

          [ Next; Exit after last ] 

End Loop

End If 

Go to Layout [ original layout ] 

Show All Records

HTH

Lee

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