Set Same Text and Color in Repeater Two as Repeater One

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)

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)

1 Like

Hi mbc66,

Thank you for helping me and sorry for the late reply. I got pulled into another aspect of this project.

I ended up using a modified version of your Example #2, by having the swatches dp get set to a given state (pink or orange, etc), onClick. Works perfectly. I think where my mental breakdown occurred was not adding [[TargetItem.index == Item.index]] , which I realize I should have used, as while I understand what is happening I’m poor at implementing.

The purpose of this prototype is to illustrate a mobile UX, where palettes get loaded into a flatbed open trailer in a factory. The user needs to be able to specify which palette was placed where and there is a product type with a color code associated with each product.

Anyway, again, thank you for taking the time to help me. I always learn a lot from you. :slight_smile:

Regards,

DRC

Hi mb66,

Another question for you, as I’m trying to learn how to do this on my own.

Looking through the statements, I honestly still don’t understand how the entire column is not getting changed when the user clicks. It’s doing exactly what I have been trying to get it to do, thanks to your help. But what is confining the change to just one cell in the column? I think knowing this could be quite handy for a number of projects.

Thanks.

DRC