Select attribute transform action

Use case

While reviewing a list of users returned from Microsoft Graph, you need to get a list of the users who have a accountEnabled attribute value set to true .

Overview

This action filters a sequence of objects by applying a test to the specified attribute of each object, and only selecting the objects where the test succeeds.

Parameters

Parameter
Description
Required

Attribute

The attribute of an object in the list that you would like to select if the condition is true. If nested, please use dot notation.

Comparison Operator

Test used for selecting matches. For information on the tests see Jinja's documentation here.

List

This is the list to run select attribute against.

Value to Compare Against

The value to compare the attribute against, this is required for most tests but tests such as true, false, defined, undefined do not require it. If a value is supplied and not needed it will be ignored.

For nested field names, separate them by dots (e.g., details.age).

Usage

Example: List Input
[
  {
    "result": {
      "result": {
        "data": {
          "age": 20,
          "bool": true,
          "username": "amorton"
        }
      }
    }
  },
  {
    "result": {
      "result": {
        "data": {
          "age": 25,
          "bool": true,
          "username": "bmorton"
        }
      }
    }
  },
  {
    "result": {
      "result": {
        "data": {
          "age": 27,
          "bool": false,
          "username": "cmorton"
        }
      }
    }
  },
  {
    "result": {
      "result": {
        "data": {
          "age": 30,
          "bool": false,
          "listah": [],
          "username": "dmorton"
        }
      }
    }
  },
  {
    "result": {
      "result": {
        "data": {
          "age": 22,
          "bool": true,
          "username": "emorton"
        }
      }
    }
  },
  {
    "result": {
      "result": {
        "data": {
          "age": 29.99,
          "bool": null,
          "username": "fmorton"
        }
      }
    }
  }
]
Example 1: Return Users With Odd Ages

Inputs:

Attribute: result.result.data.age

Comparison Operator: odd

List: See Example: List Input

Value to Compare Against: None

Example 2: Return Users With Age Greater Than or Equal to 30

Inputs:

Attribute: result.result.data.age

Comparison Operator: ge

List: See Example: List Input

Value to Compare Against: 30

Results output

The expected output for this transform is a list of objects that tested true.

Example from Example 1:

[
  {
    "result": {
      "result": {
        "data": {
          "age": 25,
          "bool": true,
          "username": "bmorton"
        }
      }
    }
  },
  {
    "result": {
      "result": {
        "data": {
          "age": 27,
          "bool": false,
          "username": "cmorton"
        }
      }
    }
  }
]

Example from Example 2:

[
  {
    "result": {
      "result": {
        "data": {
          "age": 30,
          "bool": false,
          "listah": [],
          "username": "dmorton"
        }
      }
    }
  }
]

Last updated

Was this helpful?