How would I set a sequential Ordering?

So I have to do this. I know how to create the field in the database. How do I do it to the existing FAQ's though? Would I have to set some query statement to do this? If so, what would it be? Or would it be an expression within Outsystems?


Hi Jaret,

To populate the new order attribute in the FAQ entity you either:

  1. Create an aggergate on the FAQ in the correct order, then use a foreach widget to iterate the result list and set the Order attribute to the value of the ID attribute then Update the FAQ record
  2. Use an SQL statement to update the Order attribute existing records by setting it to the ID attribute value




Hi Jaret,

I agree to the approach Daniel has mentioned above, however there is one catch that the order shall be set to the order in which aggregate will fetch the data.

Alternatively, you can create a FAQ configuration screen to set the order as shown in the attached OML, by clicking Up or Down arrow keys in the grid.. This OML performs re-sorting in local list variable. Once you have sorted all items as per your requirement, you can have an action to save the items in DB as suggested by Daniel.

Do let me know if this solution helps.




As for reordering for the first time, this could be done using a ServerAction called by a Timer or simply by a ScreenAction, like this:

After, in order to maintain the Order, you have the following Save (new/edit) and Delete actions:

- Delete (FAQs screen)

- Save (FAQDetail screen - between Validation Form and FeedbackMessage component)

Perhaps you can make a better action logic... but It works!!!

Thanks you all! All of these helped quite a bit in my understanding.