Multi row variable set display and catalog policy

Bidduam
Tera Guru

I wish to use a multi row variable set in order for people to advise what countries they are visiting on an upcoming trip along with the dates they are arriving and departing each country. Seems pretty simple really, however,

I want to have some questions before the muti row variable set is displayed, that ultimately decide if the variable set is needed or not.

For example- 

Ask a question - Are you going to more than 1 country?

If no - just show a single text field for the user to add the one country they are visiting.

If yes - show the multi row variable set, so they can list all countries along with arrival and departure dates.

 

I can not see how I can have a catalog UI policy that will allow me to add the catalog variable and multi row to be displayed in the case of corresponding answers.

I also can't see how I can add a 'normal' variable question that displays before the 'table' using a multi row variable set.

country.png

Ideas?

1 ACCEPTED SOLUTION

Bidduam
Tera Guru

I have actually now worked it out myself (not sure it is the best way or not, but it works)

 

I added two Catalog Client Scripts

One to make the MRVS not visible when the form loads initially

One to make the MRVS visible (or not) depending on if the answer to "Are you going to more than one country?" is yes or no

My MRVS is called: international_travel_details ( So replace this value in my scripts with the name (not display name) of your own MRVS)

 

The field I cared about the answer was a Yes/No field called: u_more_one_yn  (replace with your own variable name)

Also make sure if you are using something other than a Yes/No that you look for the correct values on change.

 

On Load script:

Applies to - A catalog item

Active - True

UI Type - All

Type - onLoad

Catalog item - ***name of your catalog item***

 

Applies on - at least Catalog Item view = true (up to you what you want for the others)

 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
      if(g_form.getValue('u_more_one_yn') == ''){
	//alert("Answer was NONE");

	g_form.setVisible('international_travel_details', false);
	}
}

 

 

 

On Change script:

Applies to - A catalog item

Active - True

UI Type - All

Type - onChange

Catalog item - ***name of your catalog item***

 

Applies on - at least Catalog Item view = true (up to you what you want for the others)

 

 

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

   //Type appropriate comment here, and begin script below
   if(g_form.getValue('u_more_one_yn') == 'Yes'){
	//alert("Answer was yes");

	g_form.setVisible('international_travel_details', true);
	}

   }
	if(g_form.getValue('u_more_one_yn') == 'No'){
		//alert("Answer was no");

	g_form.setVisible('international_travel_details', false);
}

 

 

 

View solution in original post

1 REPLY 1

Bidduam
Tera Guru

I have actually now worked it out myself (not sure it is the best way or not, but it works)

 

I added two Catalog Client Scripts

One to make the MRVS not visible when the form loads initially

One to make the MRVS visible (or not) depending on if the answer to "Are you going to more than one country?" is yes or no

My MRVS is called: international_travel_details ( So replace this value in my scripts with the name (not display name) of your own MRVS)

 

The field I cared about the answer was a Yes/No field called: u_more_one_yn  (replace with your own variable name)

Also make sure if you are using something other than a Yes/No that you look for the correct values on change.

 

On Load script:

Applies to - A catalog item

Active - True

UI Type - All

Type - onLoad

Catalog item - ***name of your catalog item***

 

Applies on - at least Catalog Item view = true (up to you what you want for the others)

 

 

function onLoad() {
   //Type appropriate comment here, and begin script below
      if(g_form.getValue('u_more_one_yn') == ''){
	//alert("Answer was NONE");

	g_form.setVisible('international_travel_details', false);
	}
}

 

 

 

On Change script:

Applies to - A catalog item

Active - True

UI Type - All

Type - onChange

Catalog item - ***name of your catalog item***

 

Applies on - at least Catalog Item view = true (up to you what you want for the others)

 

 

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

   //Type appropriate comment here, and begin script below
   if(g_form.getValue('u_more_one_yn') == 'Yes'){
	//alert("Answer was yes");

	g_form.setVisible('international_travel_details', true);
	}

   }
	if(g_form.getValue('u_more_one_yn') == 'No'){
		//alert("Answer was no");

	g_form.setVisible('international_travel_details', false);
}