Repeater - filter matching items

Hello,

I will appreciate your help on this. I am trying to use a repeater, which should only show matching values from a certain column. I will make it more complex once I am able to achieve this, but this is a great starting point.
So basically I need to loop through the values in ColumnA for example, find if there are any matches between them and filter and show only these rows.

Thank you for your time.

There are several ways you can achieve this, depending on your overall purpose and needs. The classic way to do this is with the Add Filter action. This the basic way to “loop through all the (rows)” and only show those rows meeting a rule. You can do this from outside a repeater, for example a button or other action/event, or from inside a repeater, likewise from a button, other user action or event. You can also use the repeater’s Loaded event to automatically apply a filter when the repeater is created. Or, you can use what I’ll call a “Big Hammer” approach and ensure that rows will always be hidden based on the dataset column values, by building a conditional case directly into the repeater’s Item Loaded event. This will be less flexible, but more reliable, and demonstrates another means of “looping through” all rows in a repeater–the Item Loaded event. (There are other approaches as well which are more complicated.)

Examples of these basic approaches are shown in this little demo file:
repeater filtering.rp (67.1 KB)

Here is the Axure documentation for repeaters and filters:

Thank you for the answer and examples. I have managed this far as to add a filter and be able to filter by a category. What I do not understand is how to find only the matching items in a category and display only this data.

In a filter, the rule specifies which column(s) to use. When the value in a row’s column matches the rule the row is shown. So, in my demo, there is a column named “Category” with two possible values, “fruit” or “vegetable” (but more could certainly exist… “spice”, “mineral” etc.) One of my sample filters uses this rule:

[[Item.Category == ‘fruit’]]

Now, if you wanted to only show rows with item name of “apple” the rule would be:

[[Item.Name == ‘apple’]]

Or, if you wanted a match of “apple or banana” the rule would be:

[[Item.Name == ‘apple’ || Item.Name == ‘banana’]]
(where the || is the logical expression of “OR”)


Depends on what you mean by “only this data” …do you mean only the rows or only the column values in those rows? Maybe a sketch, wireframe or example web site could help explain what you’re trying to achieve.

Hi @mbc66 and thank you for your help.

Sorry, what I meant is that I do not know if it is apple or banana. It is a dynamic value, which I do not know in advance - random numbers.
So if the column that I use to compare the data is something like: 123, 132, 156, 896, 123, 123
I want to show only the three matching results of 123.

Also I am struggling to find out how to group the results by this column like this - https://i.stack.imgur.com/Wvxym.jpg

Then you will have a column in the repeater dataset to contain these values. Define a filter rule using this column. For example, if your column is named “Code” then your filter rule would be [[Item.Code == '123']] . So, if a row’s Code value changes dynamically from 123 to say, 456 then that row would disappear as it no longer meets the filter rule. Likewise, if another row’s Code changes from 000 to 123 it would then appear.

First, ensure every row has a value for Brand as well as Model. Only showing the Brand for the first Model row can be tricky.

  • Easiest solution might be to have a separate row for Brand–as a subtitle and only set the text for the Brand column if there is no model (or the “Model” value is identifiable, like “subtitle” or “brand”).
  • Another option would be to create an additional column to indicate when a Brand value should be shown. Something like “Style” where a conditional case would be like,
    If [[Item.Style]] equals "subtitle" Set Text of BrandLabel to [[Item.Brand]]
  • You could also have an additional column to track the order of model within brand, and set the text for the Brand column only when the value in the “BrandOrder” column is the first (e…g, 0 or 1).
  • You could use a global variable to keep track of “new Brands” such that the text for Brand is only set for the first instance of that brand.

I’ve added a Page 2 to my demo to show examples of filtering numeric values, buttons to dynamically change the values so you can see how the filters operate. Also a categorized list like your screenshot.

repeater filtering.rp (113.2 KB)

@mbc66, thank you very much for the explanation and examples :slight_smile: