December 2, 200421 yr 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
December 2, 200421 yr 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.
December 2, 200421 yr 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.
December 2, 200421 yr 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