Set Same Text and Color in Repeater Two as Repeater One


#1

Hi,

I have a business requirement that dictates when the user clicks box 1A from repeater 1, box 2A gets the same text and background color as box 1A. I’ve figured out how to make that happen on repeater two with those values, however, instead of setting just that one box it’s setting that value for everything in that column (which doesn’t seem wrong, I’m wrong for not knowing how to confine it).

I’ve attached my .rp file for reference.

What am I missing?

Thanks for your help!

DRCUpdate Repeater Two.rp (155.8 KB)


#2

Yes, when you change something in a repeater cell it affects all instances (all rows) in that repeater, because, well, it is a repeater, so it all gets repeated. There are two general approaches I know of to confine a change to just one row. Each may take a while to understand and kind of wrap your head around…

  • Use a special event for a widget in the repeater.
  1. Set some way to identify which row to affect. This can be a global variable or text on some widget (e.g., if you want to change row 3, set OnLoadVariable to value of “3”).
  2. Trigger a “special” event for a widget in the repeater. This is usually some otherwise unused event like OnMove or OnRotate. (e.g., “Move myWidget by (0, 0)” --thus not resulting in any actual movement but will trigger the OnMove event.) Note that the widget event will be triggered in each and every row in the repeater.
  3. Add a condition to that event which tests if this row is indeed the row to be affected (e.g. "If [[item.index]] equals “3”) such that it will be fired for THE row and ignored for all rows that are not THE row.
  4. Please note this approach is superficial only, as it directly changes content in the repeater cell but not the repeater database. Anything that affects the repeater database (the structure)–such as adding/removing rows, sorting, filtering, etc.–will wipe out your changes.
    . See the palettes-V2 page in the file below for an example.

  • Update the repeater, using columns to track necessary states and changes.
  1. Ensure you have a column for each property to be changed, and some logic for applying the change (e.g., if you want to change the state of your “swatch” dp, you could have a column named “MySwatch” with possible values matching the names of its states.)
  2. Set up actions (possibly with conditional cases) in the repeater’s OnItemLoaded event to handle the various values in these columns (e.g., “Set State of MySwatchPanel to [[Item.MySwatch”).
  3. Use the Update Repeater action and set a rule to constrain which row(s) to affect. (e.g., "Update Rows Set MySwatch to “orange” where “[[TargetItem.index]] == “3” in MyRepeater”).
  4. Note this approach may take a little more setup time but is more robust.
    . See the palettes_V3 page in the file below.

Update Repeater Two.rp (390.9 KB)