38
Views
3
Comments
How to keep listbox selected values like session variable

Hi All,


Currently I have a listbox in my screen and it is used to filter the aggregate based on the selection. But, I would like to know is there a way / method to retain those selected options just like how it works like using Session variable to keep the combobox's selection? As I only know that there is no column or property field allowing me to use a local variable/session variable like combobox's property field.

listboxforumAsk22apr2020.PNG

mvp_badge
MVP
Rank: #114

Hi ZQ,

You can create a new calculated attribute in your GetMovies aggrigate 'IsSelected' (or any name of your choice) and keep its default value to false. Now use this new calculated attribute as SelectionAttribute of your ListBox.

Now where ever you want selected values in your screen you can use listfilter action (from system espace) on GetMovies.List and filter by IsSelected.

mvp_badge
MVP
Rank: #18

Hi ZQ,

Since you have multiple selections in a ListBox, you would need to store a List (not a single value) in a session variable (there are downsides to store complex data types in Session - it's not recommended, but sometimes it is the way to go).

Your ListBox selection is stored in the runtime List property of the ListBox, on a boolean attribute. You will need to convert that into a List of Identifiers of the records selected (or indexes of the rows selected) so that you can recreate the boolean attribute every time you display the ListBox.

Hope this gives you a bit of direction towards implementing your requirement.