How to sort a model based on UI only formula field value?

  • 1
  • Question
  • Updated 2 weeks ago
  • Answered
I have a model that pulls data from two different child models (objects) and display records with a column called "Age". Age is a UI only formula field and it's the max of two child models. I couldn't find a way to sort the master model (parent table) based on this calculated UI only formula field. I tried few links which are a year or two old but no success. Any help is greatly appreciated.
Photo of srikanth pasupuleti

srikanth pasupuleti

  • 122 Points 100 badge 2x thumb

Posted 2 weeks ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,148 Points 20k badge 2x thumb
What version of Skuid are you running?  More current versions have allowed for client side sort (Millau and Spark). 

On the table component you will have an option for "Sort Columns Client-side".   Once you turn this on - the "sort" option will appear in the field properties. 

Also in the action framework you have a "sort" action that allows for client side sorting.  In this case you may have to edit the page XML to define the UI only field.  We have an improvement story pending to allow fields not "server side" sortable to be selected for client side sorting. 

Hope this helps. 
Photo of srikanth pasupuleti

srikanth pasupuleti

  • 122 Points 100 badge 2x thumb
Hi Rob,

Thanks for your reply. We got the latest one (Millau (11.2.12)). I am looking to sort (ORDER by Age DESC) the records while displaying/rendering the table.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,148 Points 20k badge 2x thumb
So there are a number of ways you could do this... 

After the model is loaded you will need to trigger an action sequence.  This can be done as a model action (in Model definition),  or as an action sequence triggered by the Skuid Page:Rendered event. (look for Action Sequences area below models and components). 

 

Then add an action to the sequence that sorts the model.  You will be able to define that it is client side sorting,  which field you want,  and how it should be sorted.  See image below where I am sorting on field "len"  




That should work for you.... 
Photo of srikanth pasupuleti

srikanth pasupuleti

  • 122 Points 100 badge 2x thumb
It worked, thank you!
Photo of srikanth pasupuleti

srikanth pasupuleti

  • 122 Points 100 badge 2x thumb
Not sure if it's a version issue but I don't see what you see. Here is my view and I don't see an option to give UI only field in "Field" section.