Functionality
User Site
On user-site, during the document form-filling process, the user document accepts a text in the CSV format. It can either be manually written or copy-pasted into a text-box. Or it can come from a file during the data-merge process.
Example:
A document template contains a variable called
Animal
Before the document enters the rendering process, its value is populated with this text:
Cat,Dog,”Bear, Black”,Rabbit
As the rendering server processes the document, it calls the CsvSplit(defaultValue) method. The code of the method reads the CSV data field by field and populates these variables accordingly:
Animal01 = Cat
Animal02 = Dog
Animal03 = Bear, Black
Animal04 = Rabbit
Animal05 = defaultValue
Animal06 = defaultValue
etc
It depends on the Studio designer how many indexed variables they define and if they start from zero, one, or even from a higher number. The designer doesn’t need to define a continuous row of indexes, they can omit certain indexed variables if they like. The index number can be appended to the name with an underscore character, like this Animal_0. The index can contain padding zeroes but they are not required. This Document Action code can hadle all the cases.
Since the CSV document can contain rows and columns, the CsvSplit(defaultValue) method supports this example:
The variable Country has the value of:
England,France,Germany,Italy,Spain
Morocco,Algeria,Libya,Egypt,Sudan
Syria,Saudi Arabia,Jordan,Iraq
The document template contains these indexed variables which are populated:
Country_0_0 = England
Country_0_1 = France
Country_0_2 = Germany
Country_0_3 = Italy
Country_0_4 = Spain
Country_1_0 = Morocco
Country_1_1 = Algeria
Country_1_2 = Libya
Country_1_3 = Egypt
Country_1_4 = Sudan
Country_2_0 = Syria
Country_2_1 = Saudi Arabia
Country_2_2 = Jordan
Country_2_3 = Iraq
Country_2_4 = defaultValue