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.

Can you Loop through field repetitions?

Featured Replies

I am trying to move through and set a field's repetitions with a loop. can this be done?

I have a list of records. The count can be between 1 and 28. The list of records changes all the time so I never know how many until the the script is ran. I need to copy some text data from the list of records into the global field repetition of [28].

So I created a script to loop through the records and set the field reps, but one problem in the setfield step. I can't set the field rep count to my variable counter. I can only do it manually.

Does anyone know how this can be done in FM 7

counter = 1

goto first record

loop

setfield (data from other record; rep = count)

goto next record (exit on last)

end loop

You can loop through the repetitions using

Go to Field [repfield]

Loop

Set Field [ ; data]

Go to Next Field

Exit Loop If [Get(ActiveRepetitionNumber) = 1 or Get(ActiveFieldName) <> "repfield"]

End Loop

and not specifying the target for the Set Field step, which will use the field repetition the cursor is in. But you can't do the opposite and loop through the records, setting a dynamic repetition, unfortunately.

You could have 28 If-Then statements, like If Count = 1 Then Set Field repetition 1, etc. This is very inelegant, though. Take a look at post #132461 which may point the way toward a better solution.

  • Author

Thanks guys,

I had already started with the 28 if statements. I just thought there had to be an easier way.

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.