# Transform - Split and Sort Value

**URL:** <https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244>\
**Category:** SHF Discussion and Questions\
**Tags:** transforms, sailpoint-identity-security\
**Created:** [January 8, 2025, 4:42pm UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244 "2025-01-08T16:42:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![denanife](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/denanife/32/7268_2.png) [@denanife](https://developer.sailpoint.com/discuss/u/denanife)\
**Post date:** [January 8, 2025, 4:42pm UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/1 "2025-01-08T16:42:29Z")

</div>

Hi there,

I need to sort a valid ID and split.

I’ve already had this transform to sort:

```auto
{
    "id": "082d",
    "name": "BTG-Sort-AreaIDSAP",
    "type": "firstValid",
    "attributes": {
        "values": [
            {
                "attributes": {
                    "sourceName": "Authoritative Source",
                    "attributeName": "DescArea",
                    "accountSortAttribute": "Order",
                    "accountSortDescending": true,
                    "accountReturnFirstLink": true
                },
                "type": "accountAttribute"
            }
        ]
    },
    "internal": false
}

```

And this to split:

```auto
{
    "id": "7b7838388",
    "name": "BTG-Split-AreaIDSAP",
    "type": "split",
    "attributes": {
        "delimiter": "-",
        "index": 0
    },
    "internal": false
}

```

Basically, I need to unite both.

---

<div class="post-metadata">

**Author:** ![sup3rmark](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sup3rmark/32/36229_2.png) [@sup3rmark](https://developer.sailpoint.com/discuss/u/sup3rmark)\
**Post date:** [January 8, 2025, 4:54pm UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/2 "2025-01-08T16:54:16Z")

</div>

Which do you want to happen first? The split or the sort?

Also: your firstValid for the sort transform appears to be missing a second value to use if the accountAttribute isn’t populated. Is this intentional?

---

<div class="post-metadata">

**Author:** ![denanife](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/denanife/32/7268_2.png) [@denanife](https://developer.sailpoint.com/discuss/u/denanife)\
**Post date:** [January 8, 2025, 4:55pm UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/3 "2025-01-08T16:55:46Z")

</div>

First I need to sort, then split.

Is this not intentional, if missing can be null.

---

<div class="post-metadata">

**Author:** ![gourab](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gourab/32/18650_2.png) [@gourab](https://developer.sailpoint.com/discuss/u/gourab)\
**Post date:** [January 8, 2025, 4:56pm UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/4 "2025-01-08T16:56:37Z")

</div>

Try this

```auto
{
  "id": "xxxxxxxxxxxxxxxx",
  "name": "Transform",
  "type": "split",
  "attributes": {
    "input": {
      "type": "firstValid",
      "attributes": {
        "ignoreErrors": true,
        "values": [
          {
            "attributes": {
              "sourceName": "Authoritative Source",
              "attributeName": "DescArea",
              "accountSortAttribute": "Order",
              "accountSortDescending": true,
              "accountReturnFirstLink": true
            },
            "type": "accountAttribute"
          },
          "NONE-NONE"
        ]
      }
    },
    "delimiter": "-",
    "index": 0
  },
  "internal": false
}

```

Note: Need to be tested

---

<div class="post-metadata">

**Author:** ![sup3rmark](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/sup3rmark/32/36229_2.png) [@sup3rmark](https://developer.sailpoint.com/discuss/u/sup3rmark)\
**Post date:** [January 8, 2025, 4:57pm UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/5 "2025-01-08T16:57:41Z")

</div>

It looks like the documentation for the [split transform primitive](https://developer.sailpoint.com/docs/extensibility/transforms/operations/split) is missing its mention of the optional `input` attribute, but you should be able to add `input` within `attributes` (see the example in the transform documentation) and nest your firstValid transform within that.

---

<div class="post-metadata">

**Author:** ![denanife](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/denanife/32/7268_2.png) [@denanife](https://developer.sailpoint.com/discuss/u/denanife)\
**Post date:** [January 9, 2025, 7:38pm UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/6 "2025-01-09T19:38:56Z")

</div>

Thanks everyone,

I tried this and worked:

```auto
{
    "id": "",
    "name": "",
    "type": "split",
    "attributes": {
        "delimiter": "-",
        "index": 0,
        "throw": true,
        "input": {
            "attributes": {
                "values": [
                    {
                        "attributes": {
                            "name": "departmentad"
                        },
                        "type": "identityAttribute"
                    }
                ]
            },
            "type": "firstValid"
        }
    },
    "internal": false
}

```

---

<div class="post-metadata">

**Author:** ![PhilRawlings1](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/philrawlings1/32/37266_2.png) [@PhilRawlings1](https://developer.sailpoint.com/discuss/u/PhilRawlings1)\
**Post date:** [January 10, 2025, 10:18am UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/7 "2025-01-10T10:18:16Z")

</div>

If there is any possibility that the attribute ‘departmentad’ could be null, I highly recommend putting in a value into the firstValid to catch this. As Gourab suggested ‘None-None’ would prevent any errors from occurring

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [March 11, 2025, 10:19am UTC](https://developer.sailpoint.com/discuss/t/transform-split-and-sort-value/96244/8 "2025-03-11T10:19:09Z")

</div>

Closed on March 11, 2025, 10:19am UTC

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
