Sorting in a list box
I can't seem to figure out how to sort the items in a list box... can anybody help with this? I imagine this is a simple inquiry, but I am stumped.
Paul
-
If your listbox directly reads from your mapservice layer, I would expect the values are sorted alphabetically.
If the input of your Listbox is a DataItemList from your workflow and if you use FeatureSetToDataItemList to create the DataItemList, there is a Sort property on this activity.
0 -
Thanks Nico - The values ALMOST sort alphabetically, any reason why there would be issues with this? It is reading direct from a mapservice.
https://sgis.wellington.ca/Html5Viewer_2_0/?viewer=businessdirectoryClick on the Category Search.
0 -
This is the request as sent to the server, the results are unsorted, sorting is (/should be) done in the viewer:
https://sgis.wellington.ca/Geocortex/Essentials/REST/local-proxy/ED_Business_Directory/2/BusinessDirectory/MapServer/0/query/query?f=json &where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=Catergories
If I format the output as HTML (request as below), I see 1000 records are returned. You should increase the MaxRecordCount of your mapservice or choose a different option to populate your combobox. I'm afraid now you are missing values because only the first 1000 records in your data are scanned.
https://sgis.wellington.ca/Geocortex/Essentials/REST/local-proxy/ED_Business_Directory/2/BusinessDirectory/MapServer/0/query/query?f=html &where=1%3D1&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=Catergories
0 -
NIco thanks again, sorry if I am a total dingus, but how do you sort "in the viewer"?
0 -
I mean it is done internally in the combobox control (hidden/not configurable)
0 -
Nico - sorry, I am completely lost now. Sorting in the viewer is not configurable, but should be sortign my data, and is not. Is there actually nothing I can do to sort the data? I am confused if you are giving me hints on what to do, or if you are just telling me that I can't achieve what I want?
Paul
0 -
You can get the desired result in the following way:
- Use a Query Task and set the Out Fields property to your category field and the Return Distinct Values property to True. This will give you a list of unique category values.
- Use a FeaturesetToDataItemList activity and convert the feature set to a data item list. Set the Sort property on this activity to True. Set the Display and Value property to the name of your category field.
- Use the data item list as Input Data for your combobox on your Display Form.
- Now your combobox should show a sorted list of category values.
0 -
Amazing - thanks Nico. Very much appreciated.
0 -
Hi Paul
how about sorting at source by adding the orderBy into the request url?
Regards
Ralph
0 -
Any tips on interger natural sorting? FeatureSetToDataItem and SortFeatureSet do not sort integers in a human readable format. 0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
10 Kommentare