Need to search multiple repeaters

Hi - I need a search to span multiple repeaters, each one nestled within a collapsible area. Sort of like searching in a nested table. Here’s the link:
https://pvginz.axshare.com/#id=c16tgr&p=permissions_2

I’ve got all the nesting in one repeater now! But… search isn’t working. Can anyone help?
https://pvginz.axshare.com/#id=m3839q&p=all_in_one_repeater&g=1

And here’s the file
Role Administration.rp (7.7 MB)

Hi!

I don’t see the page “all in one repeater” in the file that you posted.

Oops! Try this file.AllOneRepeater.rp (173.3 KB)

I removed the search because I was hoping to start fresh, but having a lot of trouble getting it to work with all the other things going on!

Hi again!

Do you just want to filter the level 3 items?

If you only want to filter level 3 items, this filter (associated with a field) works:

[[ Item.level <= 2 ||  Item.Col1.toLowerCase().indexOf(This.text.toLowerCase()) >= 0 ]]

A filter compares its expression against each row. If the filter evaluates to true for a given row, the row is shown; if not, it’s hidden.

The double-pipe in the expression above means OR. When you OR two expressions together, it means that only one of the expressions needs to be true for the whole filter to be true. Example:

[[ true || true ]] (equals true)
[[ true || false ]] (equals true)
[[ false || true ]] (equals true)
[[ false || false ]] (equals false)

So the Item.level <= 2 portion guarantees that level 1 and level 2 rows will be shown no matter what.

The part of the expression after the OR checks if there is a text match. This part of the expression is tested against a row only if the first half of the expression evaluates to false (i.e., when Item.level is greater than 2). Why? Again: when the filter realizes the first part of the expression is true—as it is for level 1 and 2 rows—it already knows that the whole filter will be true because of the OR, so it doesn’t bother checking the second part of the expression.

Oh! I see that you already have a filter defined On Loaded of the repeater. So we’ll add a second filter, just like the one above, On Loaded, making sure not to say “remove other filters” on them because both need to be active. When two filters are applied, they are ANDed together.

We’ll need a local variable to refer to the field here, since “This” in the previous solution assumed that the field owned the script.

When it comes time to check for a text match, whether it is On Text Changed or pressing a button, you’ll need to force the repeater to re-evaluate its filters, because it won’t know that the text in the field has changed. If I’m not using repeater pagination, I use the command Set Items Per Page to Unlimited to force this re-evaluation.

I’m uploading the modified file to help this make sense.

AllOneRepeater.rp (174.9 KB)

1 Like

That makes perfect sense! Thanks so much for the help!

I actually decided to try searching multiple repeaters instead for simplicity. This file is doing that, but for the life of me I can’t figure out how to make the dropdown menus stay on top! Any ideas??search and filter.rp (151.5 KB)

Hi!

It’s the “bring to front” option on the “Show BTN-all” command in Item Loaded, ironically. Since Item Loaded goes through each row in the repeater one by one from top to bottom, the BTN-all panel in each row instance is being placed on top of the rows previous.

Oh good heavens. THRILLED that it’s an easy fix! Thanks!

1 Like