Map several variables to same field using record producer

Diogo Luz
Tera Expert

Hello,

 

I'm trying to map several variables to the same table field using the record producer's script. I'm using the following script as an example:

 

//current.table_field += producer.variable1;
//current.table_field += producer.variable3;
//current.table_field += producer.variable3;
 
However, I'm having difficulties separating the values ​​on different lines and with the variable name before the value. Is it possible to do it, and how ?
 
Please check attached images: Print1 is how it is right now, Print2 is how I want it to be
 
Thank you in advance,
Diogo
1 ACCEPTED SOLUTION

U_Viswa
Mega Sage

Diogo Luz,

Try adding below script in Record Porducer script section.

 

var desc='';
var variables = [producer.variable_name1,producer.variable_name2,producer.variable_name3];
for (var i=0;i<variables.length;i++) {
	var question = variables[i].getQuestion();
	var label = question.getLabel();
	var value = question.getDisplayValue();
	if(label != '' && value != ''){
		desc+= label +": "+ value +"\n" +"\n";
	}
}
//Setting All variable lables and values in description filed
current.description=desc;

 

Thanks,

View solution in original post

2 REPLIES 2

U_Viswa
Mega Sage

Diogo Luz,

Try adding below script in Record Porducer script section.

 

var desc='';
var variables = [producer.variable_name1,producer.variable_name2,producer.variable_name3];
for (var i=0;i<variables.length;i++) {
	var question = variables[i].getQuestion();
	var label = question.getLabel();
	var value = question.getDisplayValue();
	if(label != '' && value != ''){
		desc+= label +": "+ value +"\n" +"\n";
	}
}
//Setting All variable lables and values in description filed
current.description=desc;

 

Thanks,

Diogo Luz
Tera Expert

It worked perfectly, thank you for your help 🙂