3 Replies Latest reply on May 4, 2011 3:09 AM by apw

    How to get the contents of a repetition in a repeating variable

    apw

      Title

      How to get the contents of a repetition in a repeating variable

      Post

      I am using a repeating variable with text contents.

      Whenever I click a particular repetition of the variable, a script is executed which as its input needs the contents of the repetition that has been clicked.

      I thought to have achieved this by adding to the script as parameter;

      GetRepetition(repeating variable; Get(ActiveRepetitionNumber))

      But it doesn't work.

      At my earlier attempts the whole contents, i.e. all the repeated fields, of the variable were returned in stead of just the one I clicked on.

      Anyone with a bright idea? 

        • 1. Re: How to get the contents of a repetition in a repeating variable
          rjlevesque

          Just to iterate: so you need to grab the contents of a particular field to the clipboard by clicking it?

          • 2. Re: How to get the contents of a repetition in a repeating variable
            raybaudi

            "I thought to have achieved this by adding to the script as parameter;
            GetRepetition(repeating variable; Get(ActiveRepetitionNumber))"

            That couldn't work because there is no active repetition when you push a button.

            Try instead to hard-code the repetition number as the script parameter and get its content by:

            Repeating[ Get ( scriptParameter ) ]

            • 3. Re: How to get the contents of a repetition in a repeating variable
              apw

              Yes, I need the contents of the field/repetition in the repeating variable I clicked.

              Raybaudi is right, when he states that there is no active repetition when the button is placed on the repeating variable.

              I suspected that and I came up with a second-best solution:

              I detached the button from the repeating variable and created a separate button. Now I first activate the particular repetition in the repeating variable, then click the button which executes the script with the parameter GetRepetition(repeating variable; Get(Active RepetitionNumber)) and it works. However, the drawback is that I have to click twice, which is one time too much.

              I tried your solution, although I don't understand 'hard-code', and it returns "?" in stead of the contents; I don't see how it could have worked.

              Anyway, thanks for your reaction.