Set text in each repeater item equal to text in text field outside the repeater

Hi there,

I’m trying to solve the following:

I have three text fields outside the repeater widget (e. g. ‘A1’, ‘B1’ , ‘C1’) and a repeater with three rows (‘Apple’ ‘Banana’ ‘Orange’).
What I’m trying to do is to set the text of each row in the repeater equal to each text field. (‘Apple’ = 'A1, ‘Banana’ = ‘B1’,…)
I’ve already tried to store the value of the entered text in the text field as a global variable and set the text of the repeater ‘onLoadItem’ to the variable. But this causes the same name for all the rows in the repeater.

Does anybody know how to tackle this?

Thank you.

Regards,
Miriam

Hi!

You can use conditions based on Item.index. Item.index is 1 for the first row, 2 for the second row, etc. (You’ll need to enclose it in double-brackets so Axure knows it’s an expression, not literal text.) This assumes you have three widgets in the repeater row: rowLabel1 through rowLabel3.

OnItemLoad
   if (value) [[Item.index]] is equal to 1
      set text of rowLabel1 to text on widget A1
   if (value) [[Item.index]] is equal to 2
      set text of rowLabel2 to text on widget B1
   if (value) [[Item.index]] is equal to 3
      set text of rowLabel3 to text on widget C1

Make sure each condition is an IF, not an ELSE IF. (You can right-click the condition after you create it to toggle between IF and ELSE IFs. If you haven’t used conditional logic in Axure, google “axure conditional logic” and you’ll find a lot of resources.