Choices are not displaying as per the sequence given but displaying as per alphabetical order

Swetha Guligari
Tera Contributor

Hi All,

I have to create a variable in record producer which should allow multi selection of the choices. So i selected the type as list collector and table as sys_choice and created choices in sys_choice. It's working fine but it's not getting displayed as per the given sequence but in Alphabetical order. Client wanted the choices to be displayed in the given order only. How do i do it.

Regards,

Swetha

7 REPLIES 7

Mark Manders
Mega Patron

Why didn't you create a multiple choice variable and added the choices on the variable itself? You could easily just use the 'order' field to set the order of the choices. Upside: the client can maintain these themselves, while the sys_choice table is restricted to admins.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

_Gaurav
Kilo Sage

Hi @Swetha Guligari 
As per the understanding, this is not possible, you can discuss the same with the client that you can show the choice in ascending/descending order, and if they agree then it would be good.
Else you can create a new field as ORDER and mention the same order in which the client is asking and run your script accordingly.

Please mark this as helpful if this resolves your query.
Thanks!

Kishore T K
Tera Contributor

Hi @Swetha Guligari 

There is no possible way to achieve your requirement as list collector variable displays the values in alphabetical order of the field which is defined as Display = true in dictionary.

KishoreTK_0-1707380636768.png

 

As a workaround please check with your client whether you can add some prefix (like 1-,2- or 1.,2.) before the Label.

 

If this answer your question, please mark it as helpful or correct.

 

Selben
Tera Contributor

This is a little janky but it works if you aren't trying to show a ton of choices. Add a Client Script for on load or on Change. Have the script remove the choices, then re-add them in the order you want them displayed. If you need to update or change the choices often, this is not an ideal solution.

 

Basic version for onLoad

 

	function onLoad() {
	//We want to have the Basic User as the first choice, but Alphabetically this doesn't work so remove and add the choices
		g_form.removeOption('category','choice_1',"Basic User");
		g_form.removeOption('category','choice_2',"Advanced User");
		g_form.removeOption('category','choice_3',"Administrator Account");
		g_form.addOption('category','choice_1',"Basic User");
		g_form.addOption('category','choice_2',"Advanced User");
		g_form.addOption('category','choice_3',"Administrator Account");
	}