sn-record-picker Order by ?

User673228
Kilo Expert

Hi,

My question is simple : 

I have a sn-record-picker, and i want to order the field following a specific order. In my case : 

<sn-record-picker default-query="name_long!=NULL"
   field="c.cityPicker.conf"
   table="'city'"
   value-field="'sys_id'"
   display-field="'name_full'"
   search-fields="'name_long,zip,canton_code'"
   page-size="20"
   ng-change="c.changeRecord()">
</sn-record-picker>

I know actually, the order is base by the first fields in my "search-fields" parameter.

What I want, is order by "canton_code", with a specific canton, not like "order by DESC", more like = "I want to show all my canton with all canton equals to HR first".

Somebody can help me?

1 ACCEPTED SOLUTION

Jace Benson
Mega Sage

Add it to your default query, so instead of

name_long!=NULL

you'd have

<sn-record-picker default-query="name_long!=NULL^ORDERBYDESCfield"
   field="c.cityPicker.conf"
   table="'city'"
   value-field="'sys_id'"
   display-field="'name_full'"
   search-fields="'name_long,zip,canton_code'"
   page-size="20"
   ng-change="c.changeRecord()">
</sn-record-picker>

View solution in original post

3 REPLIES 3

Jace Benson
Mega Sage

Add it to your default query, so instead of

name_long!=NULL

you'd have

<sn-record-picker default-query="name_long!=NULL^ORDERBYDESCfield"
   field="c.cityPicker.conf"
   table="'city'"
   value-field="'sys_id'"
   display-field="'name_full'"
   search-fields="'name_long,zip,canton_code'"
   page-size="20"
   ng-change="c.changeRecord()">
</sn-record-picker>

Thanks 🙂 that's work

That’s great can you make this answered so others don’t look to help and if someone has the same problem they can see this solution?