# Transform issue

**URL:** <https://developer.sailpoint.com/discuss/t/transform-issue/17549>\
**Category:** SHF Discussion and Questions\
**Tags:** transforms, sailpoint-identity-security\
**Created:** [September 13, 2023, 11:01am UTC](https://developer.sailpoint.com/discuss/t/transform-issue/17549 "2023-09-13T11:01:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiran001](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/kiran001/32/28652_2.png) [@Kiran001](https://developer.sailpoint.com/discuss/u/Kiran001)\
**Post date:** [September 13, 2023, 11:01am UTC](https://developer.sailpoint.com/discuss/t/transform-issue/17549/1 "2023-09-13T11:01:39Z")

</div>

Hello everyone,  
For below transform i am getting the error “There was an exception while calculating the value for this attribute. Text ‘2023-07-19’ could not be parsed at index 10” , can you please help me to solve this error.

{  
“name”: “LCS”,  
“type”: “dateCompare”,  
“attributes”: {  
“firstDate”: {  
“attributes”: {  
“sourceName”: “Test source”,  
“attributeName”: “HIREDATE”  
},  
“type”: “accountAttribute”  
},  
“secondDate”: “now”,  
“operator”: “lt”,  
“positiveCondition”: “prehire”,  
“negativeCondition”: “active”  
}  
}

---

<div class="post-metadata">

**Author:** ![gladstoneabrahamr](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gladstoneabrahamr/32/4232_2.png) [@gladstoneabrahamr](https://developer.sailpoint.com/discuss/u/gladstoneabrahamr)\
**Post date:** [September 13, 2023, 12:39pm UTC](https://developer.sailpoint.com/discuss/t/transform-issue/17549/2 "2023-09-13T12:39:33Z")

</div>

Hi @Kiran001,

Can you try formatting the date input into ISO format before passing it to the dateCompare transform?

The [dateCompare](https://developer.sailpoint.com/idn/docs/transforms/operations/date-compare) transform recommends that the input should be on ISO8601 format,

 ![Screenshot 2023-09-13 at 6.05.16 PM](https://global.discourse-cdn.com/sailpoint/original/2X/3/3087760a0cbba081e0a6d228512a814ff05bf298.png)

And according to the [dateFormat](https://developer.sailpoint.com/idn/docs/transforms/operations/date-format) transform, ISO format looks like the following,

 ![Screenshot 2023-09-13 at 6.07.27 PM](https://global.discourse-cdn.com/sailpoint/original/2X/3/31615e0a2735d039473ef77dfa95d9fba619330a.png)

The updated transform might look like,

```auto
{
    "name": "LCS",
    "type": "dateCompare",
    "attributes": {
    "firstDate": {
        "type": "dateFormat",
        "attributes": {
          "input": {
            "attributes": {
              "sourceName": "Test source",
              "attributeName": "HIREDATE"
            },
            "type": "accountAttribute"
          },
          "inputFormat": "yyyy-MM-dd",
          "outputFormat": "ISO8601"
        }
    },
    "secondDate": "now",
    "operator": "lt",
    "positiveCondition": "prehire",
    "negativeCondition": "active"
    }
}

```

Also I would recommend you to use firstValid if you think there could be accounts without that attribute. In that case the code may look like,

```auto
{
    "name": "LCS",
    "type": "dateCompare",
    "attributes": {
    "firstDate": {
        "type": "dateFormat",
        "attributes": {
          "input": {
            "attributes": {
              "values": [
                {
                    "attributes": {
                      "sourceName": "Test source",
                      "attributeName": "HIREDATE"
                    },
                    "type": "accountAttribute"
                },
                "1995-12-31"
              ]
            },
            "type": "firstValid",
        },
          "inputFormat": "yyyy-MM-dd",
          "outputFormat": "ISO8601"
        }
    },
    "secondDate": "now",
    "operator": "lt",
    "positiveCondition": "prehire",
    "negativeCondition": "active"
    }
}

```

Hope this solves the issue.

---

<div class="post-metadata">

**Author:** ![iamnithesh](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/iamnithesh/32/42445_2.png) [@iamnithesh](https://developer.sailpoint.com/discuss/u/iamnithesh)\
**Post date:** [September 13, 2023, 2:02pm UTC](https://developer.sailpoint.com/discuss/t/transform-issue/17549/3 "2023-09-13T14:02:18Z")

</div>

> [@gladstoneabrahamr](#):
>
> `"secondDate": "now"`

Just wanted to add that as the firstDate is derived from a yyyy-MM-dd value, it will have 00:00 hrs for the time part. Hence, it is better to roundDown the second date by day as well. This can be done by using dateMath transform where expression will be “now/d” and roundUp false. Then use a dateFormat to conver the output to ISO8601

---

<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:** [November 12, 2023, 2:02pm UTC](https://developer.sailpoint.com/discuss/t/transform-issue/17549/4 "2023-11-12T14:02:50Z")

</div>

Closed on November 12, 2023, 2:02pm UTC

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