I have declared my arrays in a combo box and wants to show the data to different textbox based on combo box selection. Tried the most time consuming method and the sample below. It is working perfectly fine.
VAR fruits = ['Item | Apple | 10.0',]; //declared array
var Textbox_0 = this.getField("Textbox_0").value;
var combobox1 = this.getField("combobox1").value;
if (combobox1 == "fruits") { this.getField("Textbox_0").value = fruits[0]} else { this.getField("Textbox_0").value = "Nothing"}
My questions are. 1.Is there any way to use 1 text box and change to multiline to show all the data. Instead of creating multiple text fields? OR 2.Is there any way to define the range of textbox fields to display the data. Instead of defining one by one? example fill the data from Textbox 1 to 100 3.How to use the for loop for this? Tried with for loop but it is displaying only the last value of the array not all of them? Please help on this issue!
After some research and testing I found an easy way to do this.
var example= ["3333-Test11-8888-9090909"];
var Text1 = this.getField("Text1").value;
var Text2 = this.getField("Text2").value;
var combo1 = this.getField("combo1").value;
var number = example.map( (e,i) => (i+1)).join('\n');
var number1 = example.map(exampl => exampl.split('-')[0]).join('\n');
var number2 = example.map(exampl => exampl.split('-')[1]).join('\n')
if (combo1 == "xxxx") {
this.getField("Text1").value = (number1);
this.getField("Text2").value = (number2);
} else { this.getField("Text1").value = "Something";
this.getField("Text2").value = "Something";
}
This way PDF boxes can be limited.