How to access current value from list for more complex sort

  • 28 September 2022
  • 3 replies

Userlevel 1
Badge +3

I’m trying to create a complex sort based on values in the JobList. I need to access the current values from some of the fields on the list. I thought getCurrentListRowControlValue would get me access but I am getting “Exception: currentListRowContainer object cannot be null.”

Is there a function that can get me access to the current row within a Sort script on mobile?  Not sure if this is even possible, but without it I’m not sure how scripts would be used for sorting on mobile.

3 replies

Userlevel 1
Badge +3

I’ll give that a try, but is the sort added to the SQL query retrieving the data from the mobile database? If so we’ll need to set the user_def before the data is retrieved. I’ll report back with my results. Thanks in advance!

Userlevel 5
Badge +15

As fas as I know this is not possible as the list can only have values changed. You cannot add rows to the list or sort it via scripts.

It is however possible to create custom sort options on the Job List screen but these only sort by a column on the data. Would it be possible to use a user_def field on the task record to hold the sort value? If so, you could then create a new sort item using this user_def field. It might also then be possible to use the populate script to update this user_def field with a sort value via the script and so create the sort field dynamically via the script.

Userlevel 7
Badge +24

@Steve Hurst Do you have any ideas on this one?