Info |
---|
|
This routine is available starting with SIL Engine™ 4.8.0.11. Table plus |
---|
applyColStyleToCell | true |
---|
heading | 0 |
---|
columnTypes | s,s,s,s |
---|
multiple | false |
---|
columnAttributes | style="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold, |
---|
enableSorting | false |
---|
|
Syntax | arrayStructMap(structArray, field) | |
...
...
...
Description
Excerpt |
---|
|
Returns an indexed array of structs mapped to a given field name. |
Returns an indexed array of structs mapped to a given field name.
Parameters
Table plus |
---|
applyColStyleToCell | true |
---|
columnTypes | s,s,s,s |
---|
heading | 0 |
---|
multiple | false |
---|
enableSorting | false |
---|
|
Parameter name | Type | Required | Description |
---|
Struct Array | Array of Structs | Yes | An array of structs to be indexed. | Field | String | Yes | Name of the field to use as the indexer. | |
Return
...
Type
Struct String []
Returns an array of indexed structs.
...
Examples
Example Part 1 - Data for structs
Assume we have a CSV file containing a list of toys. There is a column for the toy name and another for the toys color.
Code Block |
---|
name, color
Airplane, White
Bouncy Ball, Blue
Car, Red
Dog, Brown
Elephant, Gray
... |
Example Part 2 - Populating structs
With the given CSV data we can quickly populate an array of structs.
Code Block |
---|
//define struct
struct _toy {
string name;
string color;
}
//create struct array and populate from csv
_toy [] toys = readFromCSVFile("toysList.csv", true); |
Example Part 3 - Mapping the struct array
Now that we have a list of structs we can map them to one of the fields.
Code Block |
---|
toysstring [] attachmentsCreatedToday;
for(string a in attachments) {
string [] file = arrayStructMapfileInfo(getAttachmentPath(toyskey, "name"a));
//mapping each array element todate thecreated name field
return toys["Bouncy Ball"].color; //element can be retrieved by name now that is has been mapped= parseDate("yyyy-MM-dd hh:mm:ss", file["created"]);
if(created > startOfDay(currentDate())) {
attachmentsCreatedToday += a;
}
}
return attachmentsCreatedToday; |
Result: "Blue"
See also
Filter by label (Content by label) |
---|
showLabels | false |
---|
max | 25 |
---|
showSpace | false |
---|
cql | label = "jiraarray_group_routine"routines" and space = currentSpace ( ) |
---|
labels | jiraarray_group_routineroutines |
---|
|