Jump 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.
Juggernaut

Featured Replies

I would appreciate it if someone could tell me how to step through the repetitions of a repeating field like this :)

Go To 1st Repetition

Loop

Set a value

Go To Next Repetition, Exit after Last Repetition

Exit Loop

etc...

Thanks

How about

Set Variable [ $j; FieldRepetitions( Get ( FileName ); Get ( LayoutName ); "YourField" ) ]

Set Variable [$i; 1 ]

Loop

Exit Loop If [ $i > $j ]

Set Field [ YourField [$i]; "whatever"]

Set Variable [$i; $i + 1 ]

End Loop

*** The Field with the number of repetitons you want filled out needs to be on the layout.

This will supposingly do:


Go to Field [ Untitled::aFieldWithRep ] 

Loop 

       .....

       Go to Next Field 

       Exit Loop If [ Get ( ActiveFieldName ) ≠ "aFieldWithRep" ] 

End Loop 





...but shouldn't really be necessary, an easier way would to have the data in a relational structure and then make the repeating field be an unstored calc'field populated on demand, by a calc' like this:





Let (

[

f =  Extend ( PO_LineItems::Item );

g = GetNthRecord ( f ; Get (CalculationRepetitionNumber ))

];

If (g<>”?” ; g; “”))

...to perform a task like as the one it originates from:

http://fmcollective.com/2007/08/29/pseudoportals-with-alternating-fill/

Then is it done completely without any syncronization issues, since your normalization would have put your data in individual records anyway :)

--sd

How about

Set Variable [ $j; FieldRepetitions( Get ( FileName ); Get ( LayoutName ); "YourField" ) ]

Set Variable [$i; 1 ]

Loop

Exit Loop If [ $i > $j ]

Set Field [ YourField [$i]; "whatever"]

Set Variable [$i; $i + 1 ]

End Loop

*** The Field with the number of repetitons you want filled out needs to be on the layout.

Your script uses a set field statement. The field does NOT have to be on the layout.

Your script uses a set field statement. The field does NOT have to be on the layout.

I beg to differ. The field DOES need to be on the layout in this instance since the script uses the FieldRepetitions function to set the number of reps to fill.

Set Variable [ $j; FieldRepetitions( Get ( FileName ); Get ( LayoutName ); "YourField" )

The script step will not set with a value if the field is not on the layout.

The script step will not set with a value if the field is not on the layout.

To avoid such problem, use:

Set Variable [ $j; GetAsNumber ( FieldType ( Get ( FileName ) ; "repeatingField" ) ) ]

Hi Daniele,

Yes I understand and agree, but the point of my sample was to Control how many reps that you want to fill by simply putting the field with the wanted reps on the layout (instead of an explicit parameter).

*** The Field with the number of repetitons you want filled out needs to be on the layout

That is why I specifically made the point with the asterisks to begin with.

Edited by Guest
rewording

I had nothing to say about your script }:(

The step I am talking about is only a suggestion to avoid the phisical presence of the field on the layout.

If someone want to fill only some rep ( and not the MaxRepeat number of the field ) may set the variable to :

GetAsNumber ( FieldType ( Get ( FileName ) ; "repeatingField" ) ) - "something"

or

Exit Loop If [ $i > $j -"something" ]

Create an account or sign in to comment

Important Information

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

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.