68
Views
7
Comments
Solved
How to sort Record List by choosed option on Combo Box?

Hi everyone,

So what im trying to do is to sort a List Record by the option that the user select on this combo box:



And what im trying to do is somethig like this:

(This is on the aggregate that is the source of the List Record that im trying to order)


When i publish this, i dont get any error message but when i go to the site and try to open the page where the record list is i got this error:


So i went to the application logs and this is what appears in the log.

I'm not understanding why does it says that the syntax is invalid when i can publish it without any problems on service studio.

Can someone explain me what i'm doing wrong or if what im trying to do isn't possible using this ifs on the sort property of the aggregate.


Note:I'm trying to do this on outsystems 11 and this is a tradicional web app.

Solution

Hi Leonardo,

You Can Use The List_Sort Action in New Server Action and Call the OnChange Action of ComboBox to that Server Action.


You should create two sort actions, One for ASC and another for DESC Like Below Image

And Assign the Source Aggregate to ListSort Souce List and Put column name in If condition (as per your Image which value is selected) and Refresh the Table and DB.

Thanks,

Mayilsamy L


Hi,

did you check this document (How to order and set the default value in a combo box)?

Cheers,
Miguel

Try this: Sort Results in an Aggregate

  1. In the aggregate, go to the Sorting panel and click on Add Dynamic Sort.
  2. The expected input is an expression of type Text. This value can be the result of a condition or other logic implemented in the expression itself. To refer to columns, you can select a variable of type Text previously defined from the Scope tree.

Leonardo,

And here you find another solution with SQL Adavance (you need to do some logic).

Cheers,

Miguel

Solution

Hi Leonardo,

You Can Use The List_Sort Action in New Server Action and Call the OnChange Action of ComboBox to that Server Action.


You should create two sort actions, One for ASC and another for DESC Like Below Image

And Assign the Source Aggregate to ListSort Souce List and Put column name in If condition (as per your Image which value is selected) and Refresh the Table and DB.

Thanks,

Mayilsamy L