July 15, 201015 yr Newbies 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.
July 15, 201015 yr 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.
July 15, 201015 yr 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.
July 15, 201015 yr 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 July 15, 201015 yr by Guest
July 15, 201015 yr 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
July 16, 201015 yr Author Newbies Worked like a champ! Can't believe I didn't notice the check box but a newbie. Thanks so much!
Create an account or sign in to comment