Check all the values of marked rows

repeater-widget

#1

How can i check if the all the marked rows values are the same?


#2

This would be fairly easy if repeaters had some kind of Row Marked event, but alas, they don’t–marking/unmarking rows is a kind of silent thing.

Here is one method… set up a “hidden function” on an otherwise unused event for one of the widgets in your repeater. The Moved or Rotated events are usually good options. Then, trigger that event from outside the repeater to get each row to successively perform your “hidden function.” For example, a Rotated event could have a conditional case that tests if the row is marked, and if so, compare its value to the value of a known marked row (you can use a global variable or the text of any widget for this purpose.)

In my demo file below, I have a button, “MARKED ROWS IDENTICAL?” to perform this test. It first initializes the text of a few widgets to blank, then rotates the “rowVal” widget by 0 degrees (so no actual rotation, just a way to trigger that event.) That widget’s Rotated event looks like this:

image

So, if the row is marked and the value of the widget, “valMarked” is blank, then this must be the first row in the repeater which is marked. The text value of “valMarked” is set to the row’s value so it can be used as a reference for the “marked row value”. The text value of “diffMarked” is set to “YES” (because if this is the only marked row, then by definition the marked row is identical (to itself).). Otherwise, if the row is marked and its value does not equal the reference value (of the first marked row) then the text of “diffMarked” is set to “NO”. So, if all marked rows have the same value then “diffMarked” would still read “YES” (and if none are marked it would remain blank.)

evaluate marked rows.rp (60.0 KB)