True or False variable values

harishdasari
Tera Guru

Hi,

Anyone please help me with the requirement.

I have Checkbox variables on the form, lets as shown below. It contains Column 1 and Column 2.

If  any one of the variable on Column 1 and Column 2 is selected on the workflow, then it should return as "YES".

If only Column 1  or Column 2 any of the variable is selected then it should return as "NO".

How can I achieve this type of requirement.

Thank you.

find_real_file.png

6 REPLIES 6

Anurag Tripathi
Mega Patron
Mega Patron

Hi Hari,

 

Try this

 

var col1=''

var col2='';

var ans=;

if(A || B || C || D || E || G)

col1=true;

 

if(H || I || J || K || L \\ M \\ N)

col2=true;

 

if(col1==true && col2==true)

answer='yes';

else

answer='no';

-Anurag

Hi Anurag,

 

Thanks for the response, I have tried the code you have provided, But it is not working.

 

Actually column1 and column2 are lables of the checkboxes.

 

could you please provide the script.

Thank you.

yea so read the chekbox using g_form.getValue(<name of field/variable>)

 

paste your script here

-Anurag

harishdasari
Tera Guru

Anurag, it is on workflow, so g_form will not work I think so.

here is the complete code I am using in workflow.

 

// All I regions
	var All_I = current.variables.All_Infiniti;
	var East = current.variables.East;
	var Northwest = current.variables.Northwest;
	var West = current.variables.West;
	var Mountain =   current.variables.Mountain;
	var North =  current.variables.North;
	
	// All N Regions
	var All_N = current.variables.All_N;
	var North_East =  current.variables.North_East;
	var Mid_Atlantic =  current.variables.Mid_Atlantic;
	var SouthEast =  current.variables.SouthEast;
	var Mid_West =  current.variables.Mid_West;
	var All_west =  current.variables.All_west;
	var Central =  current.variables.Central;
	
	
	var column1 = '';
	var column2 = '';
	
	if(East || Northwest || Mountain || West || North)
		{
			column1 = true;
		}
	if(North_East || North_East || Mid_Atlantic || SouthEast || Mid_West || All_west || Central)
		{
			column2 = true;
		}
	
	if(column1 == 'true' && column2 == 'true')
		{
			return 'yes';
		}
	else
		{
			return 'no';
		}
	
}