1 Reply Latest reply on Jul 11, 2012 8:37 AM by philmodjunk

    Updating the Wrong Repetition

    BoydReilly

      Title

      Updating the Wrong Repetition

      Post

      I have a table with 2 fields, amoung others, named Color and ColorChoice.  Both fields are text field types with 10 repetitions.  I have setup an edit box(s) with repetitions 1 through 10.  Next to it I have a dropdown set to data = Colors.  I have a values list with a choice of 5 colors.  After exiting the field box I have script capturing the repetition #:

      SetVariable[$$OnRep; Value: Get (ActiveRepititionNumber)]

      When the user clicks the dropdown choice of color the user will select the desired color.  I run this script after clicking thedropdown:

      Set Field[ColorChoice($$OnRep), Color]

      My problem is that it always fills in the ColorChoice field for repetiton 1 regardless of which one I'm on.

      Any ideas?

      TIA.

       

        • 1. Re: Updating the Wrong Repetition
          philmodjunk

          BTW, I'm assuming in my response that:

          Set Field[ColorChoice($$OnRep), Color]

          isn't exactly what you see in the script editor. correct syntax would be:

          SetField [YourTable::ColorChoice [$$OnRep] ; YourTable::Color[$$onRep] ]

          Haven't used repeating fields for this type of thing in years so I may be wrong, you may have to use the getRepetition function if that syntax is not permitted:

          SetField [YourTable::ColorChoice [$$OnRep] ; Get Repetition ( YourTable::Color ; $$onRep) ]

          I also suggest you not use pair of repeating fields for this in the first place. A related table where you have 10 related records is a much more flexible approach for doing this. Among many other advantages, you'll no longer need to keep track of the active repetition.