Searching across repeater rows for a value (in the condition builder)

repeater-widget

#1

Hope someone can help here, as this has been melting my brain for the last few hours.

The outcome I’m looking to achieve is to check whether a repeater with a particular value exists and if so execute some actions outside of that repeater. The actual example is quite complex, but imagine a button sitting above a table that, when clicked, checks to see if a particular row exists within the table and then says ‘found’ if it does. I’m not looking to filter the table or anything just provide some feedback if a match is found.

I know how to search across repeater rows and act on those that are found (as this search can be done as part of the ‘update repeater’ action). However, I can’t work out how to build a condition for a widget outside the the repeater that searches within the repeater for a row containing a value then perform actions on the external widget if it finds a match.


Editable table with repeater, input field and button
#2

Hi!

This can be done using the “listener method.” Here is how the listener method works:

  • Execute a command (Move by 0,0 is traditional) on a widget in the repeater. This item is the listener. Note that this command must be initiated from outside of the repeater.
  • When this happens, the listener will receive the OnMove message for each row instance of the repeater in the context of each row instance.

“In the context of” means that the listener’s OnMove code will have access to all of the row instance’s properties. It can examine [[Item.columnName]], [[Item.index]], etc., the same way as OnItemLoad does. In fact, when writing the OnMove code for a listener, write it the exact same way you would write an OnItemLoad handler. Think of the listener as a highly targeted OnItemLoad designed to perform a specific task.

A nice benefit of the listener is that it doesn’t write to the dataset (unless its code specifically does so).

Attached is an example with comments. The hotspot in the row is the listener.

find_val_with_listener.rp (55.4 KB)


Repeater facet filter (multi-select)
#3

Amazing, thank you so much! This is exactly what I needed and so quick!


#4

Glad it helped! This method is not obvious (or documented anywhere) but it comes in handy. I learned it here on the forums.