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.

Endless loop

Featured Replies

Could someone please take a look at the following script and see what's wrong:

Open is a field in Parent that counts the nbr of “empty” child records in CHILD.

I want the script to do the following things:

If Open < 10

Go to CHILD table

Create new record, put “A” in Source (in Child table)

Repeat the above step until Open reaches 10

When Open reaches 10 Stop the loop and Exit.

Expl: If Open = 6, when triggered the script should create 4 new records in CHILD.

The script:

IF [PARENT::Open < 10]

Go to layout [CHILD]

Loop

NewRecord/Request

SetField [CHILD::Source; “A”]

Exit Loop IF [PARENT::Open = 10]

End Loop

End If

The script is acting as if when records are created in child, either Open is not updated/or the script is not reading the value in Open and keeps creating records endlessly. When I abort the script a large nbr of records have been created and Open shows this large nbr.

What is the field definition for Open? If it's an aggregate calc, you may need to commit the records before the calc will update.

  • Author

Open = Sum(CHILD::Source)

I added CommitRecord before the ExitLoopIF step, no change the loop keeps looping.

Edited by Guest

I see two problems:

1. Sum(CHILD::Source) does not work on text values. You might try count() instead.

2. The new Child records are missing a foreign key that would link them to a Parent record, so the reference to the parent "Open" field won't show a value anyway. You would need to store the parent key in a global and set that in each new record's foreign key.

  • Author

Rectified and working :thankyou:

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.