Adding Sequence is not working in choice value for the parent choice field

Keerthana3
Tera Contributor

Hi Team,

I have requirement to use 'X' choice field from parent table shared to multiple child tables. I have below requirements:

  • Need to use choices already exist in parent table
  • Need to add new choices in each of the child tables
  • Need to show the choices in the alphabetical order

 

When tried to add Report on the parent table using the choice field 'X', the choices are not showing in alphabetical order, its displaying the choices from parent table first and then child table choices at the bottom.

 

Instead of adding all the choices in the parent table and segregating with "Configure Choice", do we have any other alternative configuration options which can be utilized here.

 

 

1 REPLY 1

Selben
Tera Contributor

I know this is an older post, but based on trying to find an answer myself along with a few other views, 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.

 

In my example below, The Carrier Plan becoming 'Verizon' we wanted to have 'In Stock' the top choice followed by 'Recommended' then finally 'Specialized'. So we have the other options "Removed" then immediately "Re-added". In addition in our use case, other Carriers did not need to show the choice so we Else remove the 'In stock' choice.

 

function onChange(control, oldValue, newValue, isLoading) {
	   if (isLoading || newValue === '') {
	      return;
	   }

	if(g_form.getDisplayValue('carrier_plan')=="Verizon"){

	g_form.removeOption('category','recommended',"Recommended");
	g_form.removeOption('category','specialized',"Specialized");
	g_form.addOption('category','in_stock',"In Stock");
	g_form.addOption('category','recommended',"Recommended");
	g_form.addOption('category','specialized',"Specialized");
	} 
	else {

	g_form.removeOption('category','in_stock',"In Stock");
	}


	}

 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");
}