286
Views
11
Comments
How to filter a list through a variable as you set its value
Question
Application Type
Reactive

I have a list coming from db, an array of objects, i am filtering it through a variable linked to a input box, I wish it to filter things as i type, like if there are two elements such as project and documentation, and i type p in input box it should filter and only show projects on table

2024-05-08 06-29-37
Prince Aadil Khan Panwar

Use like into the aggregate in the filter as

User.name like "%"+searchvariable+"%"

And on the change screen action try to refresh the same entity

Hope this helps if not please try to attach the screen shots

Thanks 

Prince

UserImage.jpg
Shivang Shukla

The list is already stored in a variable, please tell me how to filter it from there

2024-05-08 06-29-37
Prince Aadil Khan Panwar

here is OML take help from it i have applied the filter into the user's name with the input applying on key press action.

Assignmentfilter.oml
2024-05-08 06-29-37
Prince Aadil Khan Panwar
UserImage.jpg
Shivang Shukla

Hey, thanks for the time taken to create the oml, but as i said the data is already stored in a variable, and i want that filtered only.

2023-11-22 10-51-50
Jozy Sohail

Hi Shivang,

You can also use the index function in ListFilter action on change of your input for your use case like this.

Hope it helps,

Thanks

UserImage.jpg
Shivang Shukla

This method isnt working for me, even simple filter isnt working

2023-11-22 10-51-50
Jozy Sohail

Hi Shivang,

Is it possible for you to share some screen shots of your structure or logic that you are trying to filter, it will be easy to help you.

Thanks

UserImage.jpg
Shivang Shukla

I wish to apply a filter on this list, as i type in the input above, the list should filter out, what to do?

the list is a list of a structure that i defined for the sql to store the data structure on.

I am also storing the values into client variable to make them readily available if one come to this page again, via JSon serializing it first.

2023-11-22 10-51-50
Jozy Sohail


Use this condition in your listfilter in the onChange of your input.
If it doesn't work please share your OML

Thanks

2024-07-05 14-16-55
Daniël Kuhlmann
Ā 
MVP

Hi Shivang,

Why is it a requirement to filter the local list instead of the database?

Your approach can yield serious performance problems.

You query more data from the database than you need, making the query to the database slower. It will also consume more memory on your front-end-server as it needs to keep more data in the list than you require. Depending on the number of data you store in the list, this could even lead to an unresponsive application.

From a performance best practice, you only query the data you require, and as such apply the filter on your aggregate or advanced SQL statement.

Furthermore, filtering on an aggregate or an advanced SQL gives you more options on how to filter than filtering a list stored in a local variable.

Regards,

Daniel

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.