Filtering by email

Hi
I have a problem with filtering by for example email.

I have created a repeater with a list of emails and want to search by writing to the input field for example “email1” but It doesn’t work.

I created repeater “Search__Correspondence”
with column name “Column0”

Next, add a text field and add case “OnTextChange” > Add Filter with rule:
[[Item.Column0 == This.text ]]

Output I want to get:
When I write on textfiled “email1” on screen should give me only row with email1 data.

When I change data to numbers e.g. 1, 2,3, 4 this rule is give me good rows.

Anybody help?

Hi!

This Add Filter code is on the text field, correct?

The field has access to [[This.text]] because “This” resolves to the text field itself, and “.text” is one of its properties. However, the text field has no idea what [[Item.Column0]] is. The field doesn’t have its own “Item” property, after all.

When a repeater is the “target” of a command (as it is of your Add Filter command) and you want to access one of its row properties via the Item object, such as Item.columnName, Item.isMarked, etc., use TargetItem instead of Item.

So you would use…

[[TargetItem.Column0 == This.text ]]

If you also want the repeater to show all rows when the field is blank, modify the filter as follows:

[[This.text == '' || TargetItem.Column0 == This.text ]]

The double-pipes means OR, so the expression in English is, "If my text is blank or if my text matches Column0 for a particular row, show that row.

Note that I prefer doing it the other way around, which is more performant. Add the filter to the repeater itself OnLoad of the repeater. Since the filter is added to the repeater, use Item rather that TargetItem, and all you have to do when changing the text in the field is to force the filter to re-run itself.

OnLoad (of repeater - NOT OnItemLoad)
  Add Filter [[LV_fieldText == '' || Item.Column0 == LV_fieldText]]

…where LV_fieldText is a local variable pointing at the field’s text.

A filter until deleted hangs around; it just needs to be notified if something it depends upon changes. This happens automatically if you are adding a row, for instance, because the repeater is aware that a row has been added to it. But the repeater will have no idea when the text of the field changes. Thus, you need to force a re-evaluation of the filter when the text changes.

OnTextChange (of field)
  Set Current Page of (repeater) to 1

Even though the current page of the repeater is already 1 (unless you are using repeater pagination), the repeater will redraw itself.

Here are the two solutions on two different pages.

filteringUsingTargetItem.rp (63.0 KB)

Thanks for the fast reply and give some answers.

When I read you mockup and how you do this I figure out that my solution was good but I have to write all string. For example, I have to write in text field “email1” I can’t write incomplete “ema”. So this was my problem :wink:

Do you have a solution to dynamic search?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.