Order columns based on filter/parameter

Hello team

I have a dataset in Quick where I created a Table, I want to create a filter/parameter to order my dataset according to the value I select for this filter/parameter

For example, my dataset has these numeric columns c1, c2 and c3

My filter/parameter has the same values c1, c2 and c3

If I select c1 for my filter/parameter, my table will be ordered by c1 column

If I select c2 for my filter/parameter, my table will be ordered by c2 column

If I select c3 for my filter/parameter, my table will be ordered by c3 column

Hi @raul.pontello and welcome to the Quick Community!

You were on the right path! Parameters are the right way to go about this, but the hard part is connecting the parameter to the visual. To do this, I created a calculated field that essentially captures the value that is selected in the parameter. My formula for my calculated field is as follows:

ifelse(

${SortOrderParam} = โ€˜c1โ€™, c1,

${SortOrderParam} = โ€˜c2โ€™, c2,

${SortOrderParam} = โ€˜c3โ€™, c3,

0

)

After you create the calculated field, you then add it to your table visual. It will look a little weird as you will have two columns be identical but in order to sort the visual by a field, the field needs to be included in the visual.

After you select the calculated field that you created that helps connect your parameter to the visual, you should be good to go. In terms of any cosmetic adjustments, I would recommend hiding the SortOrder column from your visual. It will still be part of the visual, but the repeated information is not needed for the viewer.

Hope this helps!

Brilliant, this solved my problem

Thank you

1 Like