Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)
Teams
, (opens new window)

Power Scripts for Jira Cloud
Results will update as you type.
  • Get started
  • Configuration guides
  • Integration guides
  • Feature guides
  • Advanced features
  • Migration resources
  • Simple Issue Language
    • Getting started with SIL
    • SIL reference guide
    • SIL Functions library
      • Function Index
      • Packages
      • Array Functions
        • arrayAddElement
        • arrayAddElementIfNotExist
        • arrayDeleteElement
        • arrayDeleteElementAt
        • arrayDiff
        • arrayElementExists
        • arrayFind
        • arrayFindBinary
        • arrayGetElement
        • arrayIntersect
        • arrayKeys
        • arrayKeySort
        • arraysConcat
        • arraySetElement
        • arraySize
        • arraySort
        • arrayStructMap
        • arrayStructSort
        • arrayToSet
        • arrayUnion
        • excludeSubarray
        • subarray
      • Basic Functions
      • Date and Interval Functions
      • Excel Functions
      • File Manipulation Functions
      • HTTP Functions
      • Incoming Mail Processing Functions
      • Integration with Other Systems
      • Jira Administration Functions
      • Jira Integration Functions
      • Jira Service Management Functions
      • Jira Software Functions
      • Listener Functions
      • Math Functions
      • Parameter Functions
      • Scheduling Functions
      • String Functions
      • System Integration
      • Webhooks Functions
  • Tutorials and recipes
  • Jira Product Discovery support
  • Release notes
  • Help and support
    You‘re viewing this with anonymous access, so some content might be blocked.
    /
    arrayStructMap
    Updated Aug 08

    arrayStructMap

    Syntax

    arrayStructMap(structArray, field)

    Package

    array

    Alias

     

    Pkg Usage

    structMap(structArray, field)

    Description

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

    Parameters

    Parameter name

    Type

    Required

    Description

    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.

    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.

    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.

    //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.

    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;

    Result: "Blue"

    See also

    • Page:
      arraySetElement
    • Page:
      arrayDiff
    • Page:
      arrayKeys
    • Page:
      arraySize
    • Page:
      arrayUnion
    • Page:
      arrayDeleteElement
    • Page:
      arrayStructMap
    • Page:
      arraysConcat
    • Page:
      arrayElementExists
    • Page:
      arraySort
    • Page:
      arrayGetElement
    • Page:
      arrayAddElementIfNotExist
    • Page:
      arrayToSet
    • Page:
      arrayStructSort
    • Page:
      arrayFindBinary
    • Page:
      arrayDeleteElementAt
    • Page:
      arrayAddElement
    • Page:
      arrayFind
    • Page:
      arrayIntersect
    • Page:
      subarray
    • Page:
      excludeSubarray
    • Page:
      arrayKeySort
    Peacock

    Need support? Create a request with our support team.

    Copyright © 2005 - 2025 Appfire | All rights reserved.

    {"serverDuration": 13, "requestCorrelationId": "1a37f8e34efd493ba87f8cd25c510bad"}