Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6081 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.

Posted

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

Posted

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.

Posted

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.

Posted

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" ) ) ]

Posted (edited)

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
Posted

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" ]

This topic is 6081 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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