I have an option with value 1 to 999. On the form the option values are displayed as followed : 1, 10, 100 …2, 21…3, 31… etc…
However, I would like the option value to display as : 1, 2, 3…up to 999
Can someone tell me how i can get the option values ordered correctly
My DHIS2 version is 2.36.11
You can go to maintenance app and open the option set and select “Sort Manually” and re-arrange the options as per your need and save.
I know it’s a bit of a hassle doing this for 1000 options.
Note: Clear the cache using cache cleaner app after making changes
On another note, may I know the reason why you have configured an option set instead of a integer type data element and a program rule to check the range entered by user falls between 1-999?
@rithvik thank you for your reply. Unfortunately, the manual sort is working only up to 50 optionvalues, it is not allowing me to go above
The reason why i wanted the option set is to avoid manual error typing
still not getting how to fix this error
One more trick is to export the option set and import it back. It is a bit technical to follow.
Please test this before performing this on production server
- go to maintenance app → option set.
- right click on the option set you intend to modify and click show details
- You will see a popup. Click on the API URL.
- It will open a new tab with the option set details.
?fields=*,options[*] after the URL.
- Save this details by right clicking on the page and clicking save as
- Save it as optionSet.json (any name would work but the extension should be .json)
- Open this file in any editor of your choice.
- Modify the sortOrder value corresponding to each option and save the file
- Open Import/Export app and select metadata import
- Upload the modified file and change the Merge mode to Replace
- Click on start dry run, to validate the json for any errors.
- If there are no errors for dry run, then click on Start Import.
This would update all the options with order provided in the file.
Clear cache and verify the order in the corresponding apps.
@rithvik thank you so much. I have to tell you that this file, I uploaded it with the right numeric ascending order. I dont think export/correct/import will change anything
If you think the import has been done properly, then use the API call above to verify the same. If you see the sortOrder field is different than expected, then exporting-> correcting-> importing will fix the issue.