Display Data with and without filter

Hi everyone, so I'm facing a small problem here. I'm trying to figure out how to show the data in the table but without the filter condition, and when the inputs are entered (Name, Make, Model, year) it will show the data based on the condition.

The table will be empty if I apply the filter condition because the inputs must be entered. 

if anyone can help, I'd appreciate that!!

p.s: I'm using Reactive web development.

For the filter in your aggregate, do something like " CarPart.Make = MakeSearchFilter or MakeSearchFilter="" "

Or, if you want to be able to search on parts of the entered text, something like

CarPart.Make like "%" + MakeSearchFilter + "%"

which also removes the need for explicit testing on empty.

Kilian Hekhuis wrote:

Or, if you want to be able to search on parts of the entered text, something like

CarPart.Make like "%" + MakeSearchFilter + "%"

which also removes the need for explicit testing on empty.

I'm a bit confused, what is MakeSearchFilter? sorry haha


The hypothetical Variable that's bound to your search filter Input ;).

Kilian Hekhuis wrote:

The hypothetical Variable that's bound to your search filter Input ;).

still won't work, it wont show anything now 

I did it like this if thats what you meant


Why is there an "&" in there?

Kilian Hekhuis wrote:

Why is there an "&" in there?

isn't that how you told me to do it?? or maybe I did it wrong


Please, take a look at what I wrote. I want to help you, but it seems you don't make any effort to understand what I say.

Kilian Hekhuis wrote:

Please, take a look at what I wrote. I want to help you, but it seems you don't make any effort to understand what I say.

I'm really sorry for that, but did you mean that search will show the items that have similar name or? Sorry it's a bit confusing.


You made a typo. You typed "&" instead of "%". I pointed it out. You didn't understand. What else is there to say?

Kilian Hekhuis wrote:

You made a typo. You typed "&" instead of "%". I pointed it out. You didn't understand. What else is there to say?

Yea that's my bad, sorry for that. but what I'm trying to fix isn't that. the problem I'm having is displaying all the records in the Item entity, then when the user puts the input for a specific item, it will show only that afterward.

This pic is without the filter

this what I want to show to the users on the first page when the users open the website, when they enter the input variables, I want to show that specific item. When you apply the filter on the entity, the data on main screen is empty till a search happens, but I dont want that.


this pic is when the filter is applied, I dont want to show it empty even without searching

Hi Ali,

let me see if i get you right,

when you open that search screen you want your list empty right,

then when the user star using the search inputs show the specific items,

then clear the filters and again your list most be empty right?

If that the case you should put on your aggregate a "OR" condition using your filter exactly what you have it but

instead of passing some variable must be on NULL, something like this

(CarPart.Make like "%" + MakeSearchFilter + "%") OR
(CarPart.Make like "%" + NullTextIdentifier() + "%")

if i get you wrong you maybe could provide us with a example of your OML

Regarts,

Frederick Lozano.

Frederick Lozano wrote:

Hi Ali,

let me see if i get you right,

when you open that search screen you want your list empty right,

then when the user star using the search inputs show the specific items,

then clear the filters and again your list most be empty right?

If that the case you should put on your aggregate a "OR" condition using your filter exactly what you have it but

instead of passing some variable must be on NULL, something like this

(CarPart.Make like "%" + MakeSearchFilter + "%") OR
(CarPart.Make like "%" + NullTextIdentifier() + "%")

if i get you wrong you maybe could provide us with a example of your OML

Regarts,

Frederick Lozano.

Hello Frederick,

No, completely the other way around. I want the list to be showing all items, but when the user uses the search action, then it will show the specific item.

the search page should show all items, and when a search is done, show only that item. 

if that's possible 


Hi Ali

try to use filter like this

SyntaxEditor Code Snippet

Car.Name like "%" + Session.SearchKeyword + "%" or Car.Name = ""

@Seema: that's no good. It displays empty car names (which I'm sure there aren't), and also cars that are filtered on name.

@Ali: the filter as I proposed should work. If the filters are empty, it should filter all records. If that doesn't happen, there's another error in your query. Can you post a Module so we can take a look what's wrong?

Kilian Hekhuis wrote:

@Seema: that's no good. It displays empty car names (which I'm sure there aren't), and also cars that are filtered on name.

@Ali: the filter as I proposed should work. If the filters are empty, it should filter all records. If that doesn't happen, there's another error in your query. Can you post a Module so we can take a look what's wrong?

Yea sure, I think my situation is a bit confusing tried everything but didn't work, if it doesn't I'll just use a different view of the Search Screen.


Solution

Hi Ali,

The last part of the condition is "Item.Year = Year". So it always filters on year. If you don't want that, change it to "(Item.Year = Year or Year = 0)".

Also, I'd advise you to split Filters instead of using "and". So then it'll be like this:

Solution

Kilian Hekhuis wrote:

Hi Ali,

The last part of the condition is "Item.Year = Year". So it always filters on year. If you don't want that, change it to "(Item.Year = Year or Year = 0)".

Also, I'd advise you to split Filters instead of using "and". So then it'll be like this:

OMG, It Worked!!! Finally! Thank you so much sir, and sorry for the previous mistakes.

also thanks to everyone that tried to help, much appreciated!


Hi Ali,

Glad I could be of help :). In general, when no data shows, try to elminate the filters one by one, and see where the problem lies. In this case, it was the "Year" filter that made the output empty. Happy coding!

Kilian Hekhuis wrote:

Hi Ali,

Glad I could be of help :). In general, when no data shows, try to elminate the filters one by one, and see where the problem lies. In this case, it was the "Year" filter that made the output empty. Happy coding!

True, I will try to be better and learn every day from my mistakes. I appreciate your help!