How to make search box for lists?


Hi

I  tried making a search box for a list but its not working, don't know why.

I attached the OML file.

Hello Faris.

You are right in one thing. In Mobile/Reactive screen refreshs automatically.

But what you are doing is a query. You need to create a OnChange action for the input that refreshes the query. That will refresh the screen.

Notice that each refresh will be a call to the server so, if that list is large, you should replace the OnChange by a OnClick or do it OnChange over a local database.

Nuno Reis wrote:

Hello Faris.

You are right in one thing. In Mobile/Reactive screen refreshs automatically.

But what you are doing is a query. You need to create a OnChange action for the input that refreshes the query. That will refresh the screen.

Notice that each refresh will be a call to the server so, if that list is large, you should replace the OnChange by a OnClick or do it OnChange over a local database.

I'm kinda new to Outsystem, how to I create an OnChange and what should I put in it


You create the OnChange by selecting an action to call OnChage of the text input. Because you don't have it yet, you select Create Action.

That action will simply be a refresh of the query.

That's it.


Later, keep an eye on the warnings Service Studio is giving. You are calling a CreateAction client-side. That is not very safe.

Go to the Learn section to see how it should be done.

Nuno Reis wrote:

You create the OnChange by selecting an action to call OnChage of the text input. Because you don't have it yet, you select Create Action.

That action will simply be a refresh of the query.

That's it.


Later, keep an eye on the warnings Service Studio is giving. You are calling a CreateAction client-side. That is not very safe.

Go to the Learn section to see how it should be done.

Thanks I did it, but when I seach I have this "error excuting query".

I'm aiming to fix the warning, but I just need to finish the app and then check every warning.

Solution

First, your query is wrong.

Each condition must be fulfilled. It works exactly as if it had AND.

You are doing Reporter is like AND Flight is like AND From is like. It should be in a single line with an OR.



But the error is that you are doing a Sort By SearchInput.

You don't write in SQL "Order by "JOHN"!

It should be by a column of the entity. What about Date?


Solution

Nuno Reis wrote:

First, your query is wrong.

Each condition must be fulfilled. It works exactly as if it had AND.

You are doing Reporter is like AND Flight is like AND From is like. It should be in a single line with an OR.



But the error is that you are doing a Sort By SearchInput.

You don't write in SQL "Order by "JOHN"!

It should be by a column of the entity. What about Date?


Thank you so much it works!

Can I do like search for date and name and flight together to filter data more? Now I can search only one of them


For that you'll need multiple inputs and multiple variables and then, you apply one condition for each on the query (like you had, but now with one line for each variable instead of the same in all).

That gets very confusing on the screen, but they can be optional filters, not visible until you click "see more". You can be creative on that.