js22 Posted June 13, 2007 Posted June 13, 2007 Hello, I am having a difficult time with a script that I'm writing. I'm looping a delete portal row. Here is my script: Set Error Capture [ On ] Set Variable [ $OldNum; Value:Run:# of Samples ] Show Custom Dialog [ Title: "Change Number of Samples"; Buttons: “OK”, “Cancel”; Input #1: Run::# of Samples, "New Number of Samples" ] Set Variable [ $NewNum; Value:Run::# of Samples ] Set Variable [ $Counter; $NewNum ] Freeze Window If [ Evaluate ( $OldNum ) ≥ Evaluate ( $NewNum ) ] Loop Go to Portal Row [ Run::# of Samples + 1 ] [ Select; No dialog ] Delete Portal Row [ No dialog ] Set Variable [ $Counter; $Counter + 1 ] Exit Loop If [ $Counter > $OldNum ] End Loop End If This script is going to delete all extra samples and the information in the portal row. My Problem is that is switches portals. I have two portals on the layout; one is the "sample info" [where I want to delete records] and a "procedures" portal. So lets say I have 8 samples on the record but then I want to change it to 4. I run the script and it deletes sample 5 on the "sample info" portal. But then it jumps to the "procedures" portal and then deletes row 5 until the exit loop criteria is met. Does anyone know how to keep it in the first portal so it just keeps deleting the extra samples and then exits the script? Any help would be great, Thanks js22
Genx Posted June 13, 2007 Posted June 13, 2007 Set Error Capture [ On ] Set Variable [ $OldNum; Value:Run:# of Samples ] Show Custom Dialog [ Title: "Change Number of Samples"; Buttons: “OK”, “Cancel”; Input #1: Run::# of Samples, "New Number of Samples" ] Set Variable [ $NewNum; Value:Run::# of Samples ] Set Variable [ $Counter; $NewNum ] Freeze Window If [ $OldNum ≥ $NewNum ] Go to Portal Row [ Run::# of Samples + 1 ] [ Select; No dialog ] Loop Delete Portal Row [ No dialog ] Set Variable [ $Counter; $Counter + 1 ] Exit Loop If [ $Counter > $OldNum ] End Loop End If Not sure if that will work, but try it out. On a different note, you could also give the portal a name and set the script up to go to object before each call.
comment Posted June 13, 2007 Posted June 13, 2007 Why not: 1. Go to Related Record [show only related records] 2. Omit Multiple Records [ ] 3. Delete All Records
Genx Posted June 13, 2007 Posted June 13, 2007 The one and only reason I can think they chose the above is that they don't have a layout?
Recommended Posts
This topic is 6374 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