Reactive Web: Persistent Filter
Question
Application Type
Reactive

This question is based around what is best practice for filtering aggregates in Reactive web.

Scenario: I have a main screen and a filter with 10+ options, all basic data types (text/integer/identifiers). The filter choices need to be persistent for the user when navigating back to the main screen.


 In traditional web previously I have made a structure of the Filter, and then used that filter structure as a session variable. This allows the user to set filtering, then leave the page and when they return the same filters will be in place. 


How should I do this in Reactive. I could make Client variables for each of the filter fields, but that doesn't seem right. I also thought about saving the filter to an entity against a userid - but since all the data loads asynchronously, would that not create a challenge to use that to filter the data for the screen?


Thanks

Chris

Hi Chris,

At the moment I'm using the solution of using client variables for each filter, and group them in a folder. But if someone has a better solution I'm interested too.

Thanks for the reply Jesse. Glad to know im not the only one doing it that way.

Chris

What you could do is still use your filter structure, but to store it in a client variable, you JSONSerialize it into 1 text. So your client variable will have a JSON representation of your structure.

Whenever you need the filters again, you deserialize it back to the structure.

mvp_badge
MVP

Hi Chris,

In my opinion this is exactly a case that you should use a Client Variable.

Check this video about the usages of it.

One of the sample when using it, is a Search KeyWord that would be also a filter:


The only problem I see in this case is if the filters you are storing in Client Vars are in anyway sensitive informations.

If not, I think the right way to do what you want is indeed using the Client Vars.


Cheers and Regards,

RR :)


I'm having this 'dillema' too, although placing all the client variables in folders do the trick, i think it would me much better if OutSystems allows the developers to declare Records in Client Variables, it would help a lot implementing this kind of pattern.

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