Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Looping Delete Portal Row

Featured Replies

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::o# 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

Set Error Capture [ On ]

Set Variable [ $OldNum; Value:Run::o# 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.

Why not:

1. Go to Related Record [show only related records]

2. Omit Multiple Records [ ]

3. Delete All Records

The one and only reason I can think they chose the above is that they don't have a layout?

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.