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 through Portal Rows

Featured Replies

I have done many scripts with loops but today I am having a brain freeze I believe. I am working on a payment screen for our database. There is a field for check amount and amount remaining. Then a portal which lists outstanding invoices for a specific customer. I want to click an 'Auto Apply" button that loops through the portal rows and applies the payments, Apply the full amount of the balance if the amount remaining is > or = the balance or apply the amount remaining if the balance is > than the amount remaining. For some reason it's not working correctly. The last portal row does not apply correctly. Here's the script, I'm sure it's something stupid that I'm missing.

Set Error Capture [ On ]

If [ Payments::Outofbalance ≤ 0 ]

Show Custom Dialog [ Message: "No payments to apply."; Buttons: “OK” ]

Halt Script

End If

Go to Portal Row

[ Select; First ]

Loop

Exit Loop If [ Payments::Outofbalance = 0 ]

Go to Portal Row

[ Select; Next; Exit after last ]

If [ Payments Inv Client::Balance ≤ Payments::Outofbalance ]

Set Field [ Payments Inv Client::Amounttoapply; Payments Inv Client::Balance ]

Else

If [ Payments Inv Client::Balance > Payments::Outofbalance ]

Set Field [ Payments Inv Client::Amounttoapply; Payments::Outofbalance ]

End If

End If

End Loop

Edited by Guest

would it work if you freeze the window, then script a GTRR (show only related records), do your loop there, and return to the last layout?

The most obvious thing - which I think is in error - is that you have the "Go To Portal Row: Select: Next: Exit after last" in the loop *before* any processing steps. Unless you intend to skip the 1st portal row, the "go to next" step ought to be immediately before the "End Loop" step.

The other things that "appear" to be in error is the absence of any step which adjusts the amounts remaining after applying a payment. If I'm right about this, then your script would apply the lessor of the client's check amount or the invoice balance, to every row in the portal except the 1st.

Since you are ranked "Advanced", I doubt that I have debugged your problem, but you never know.

Chappy

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.