Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table plus
applyColStyleToCelltrue
heading0
columnTypess,s,s,s
multiplefalse
columnAttributesstyle="background:#e5e7ea;font-weight:bold,,style="background:#e5e7ea;font-weight:bold,
enableSortingfalse

Syntax

arrayStructMap(structArray, field)

Package

array

Alias

Pkg Usage

structMap(structArray, field)

Description

Excerpt
hiddentrue

Returns an indexed array of structs mapped to a given field name.

Returns an indexed array of structs mapped to a given field name.

...

Table plus
applyColStyleToCelltrue
columnTypess,s,s,s
heading0
multiplefalse
enableSortingfalse

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

String []

Returns an array of indexed structs.

...

Now that we have a list of structs we can map them to one of the fields.

Code Block
string [] attachmentsCreatedToday;

for(string a in attachments) {
    string [] file = fileInfo(getAttachmentPath(key, a));
    date created = parseDate("yyyy-MM-dd hh:mm:ss", file["created"]);

    if(created > startOfDay(currentDate())) {
        attachmentsCreatedToday += a;
    }
}

return attachmentsCreatedToday;toys = arrayStructMap(toys, "name"); //mapping each array element to the name field

return toys["Bouncy Ball"].color; //element can be retrieved by name now that is has been mapped

Result: "Blue"

See also

Filter by label (Content by label)
showLabelsfalse
max25
showSpacefalse
cqllabel = "array_routine" and space = currentSpace ( )
labelsarray_

...

routines