Newbies jedupree Posted July 15, 2010 Newbies Posted July 15, 2010 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.
TheTominator Posted July 15, 2010 Posted July 15, 2010 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.
TheTominator Posted July 15, 2010 Posted July 15, 2010 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.
bcooney Posted July 15, 2010 Posted July 15, 2010 (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 July 15, 2010 by Guest
Lee Smith Posted July 15, 2010 Posted July 15, 2010 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
Newbies jedupree Posted July 16, 2010 Author Newbies Posted July 16, 2010 Worked like a champ! Can't believe I didn't notice the check box but a newbie. Thanks so much!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now