The data structure used to hold both the Advanced Row Field and the Advanced Table Field is a bi-dimensional string array. In SIL terms it is expressed like this:
The particularities for the Advanced Row Field are:
the array’s first dimension size is equal to the number of values that the field stores (1 for Simple select, Autocomplete and Generic field or N - number of selected values - for Multiselect);
the array’s second dimension size is equal to the number of columns that are configured for the field.
Advanced Database Row Field can be used in SIL scripts to both read and write values into issues.
Let’s take the following Advanced Row Field as example:
Get the field value
Given the field above, the following SIL code would be used to obtain the fields value for the issue with key ‘key’:
string[][] fieldVal = %key%.customfield_10300;
return fieldVal;
Result - 10|ES|Spain|1492-10-12|30103.51|Madrid|true
If we run the same script for an Autocomplete Advanced Row Field (configured with id and name as columns):
Result - 10|Spain
If we run the same script for a Multiselect Advanced Row Field (configured with id and name as columns), having multiple values already selected:
Result - 2|Germany|3|France
Get the value of a field’s column
To retrieve a specific Advanced Row Field’s value for a issue and column we can use an array like below. In this example we will retrieve the country name:
string[][] fieldVal = %key%.customfield_10300;
return fieldVal[0][2];
Result - Spain
Similarly, to retrieve the country’s capital, we use the following:
string[][] fieldVal = %key%.customfield_10300;
return fieldVal[0][5];
Result - Madrid
For an Autocomplete Advanced Row Field (configured with id and name as columns) we can only retrieve columns with index 0 (id) or 1 (name):
string[][] fieldVal = %key%.customfield_10400;
return fieldVal[0][0];
Result - 10
string[][] fieldVal = %key%.customfield_10400;
return fieldVal[0][1];
Result - Spain
For a Multiselect Advanced Row Field (configured with id and name as columns) we can only retrieve columns with index 0 (id) or 1 (name), but we can extract them from each of the values the multiselect holds (notice the first index):
string[][] fieldVal = %key%.customfield_10500;
return fieldVal[0][2];
Result - Germany
string[][] fieldVal = %key%.customfield_10500;
return fieldVal[1][2];
Result - France
Set the field value
The Advanced Row Field value should be set using a bi-dimensional array:
%key%.customfield_10300 = {{10, "ES", "Spain", "1492-10-12", "30103.51", "Madrid", true}};
The same syntax is valid for an Autocomplete Advanced Row Field (configured with id and name as columns):
%key%.customfield_10400 = {{10, "Spain"}};
If you need to set multiple values to a Multiselect Advanced Row Field (configured with id and name as columns), here is an example:
%key%.customfield_10500 = {{2, "Germany"}, {3, "France"}};