dateMath error - IDN Transform

There was an exception while calculating the value for this attribute. DateMathTransform requires an input date or date expression with ‘now’

I’m not sure why I’m getting this error as a different transform is working, but the date format is different. I’m trying to fake out the date format by converting it and then converting it back, but the original format is ISO8601 and I have tried leaving that for the inputFormat and outputFormat.

{
    "id": "50d4d7b4-3524-4008-ba44-8d4512d77f37",
    "name": "test attr 1",
    "type": "static",
    "attributes": {
        "fiveDaysOut": {
            "attributes": {
                "negativeCondition": "no",
                "positiveCondition": "yes",
                "firstDate": "now",
                "operator": "gte",
                "secondDate": {
                    "type": "dateFormat",
                    "attributes": {
                        "inputFormat": "ISO8601",
                        "outputFormat": "ISO8601",
                        "input": {
                            "attributes": {
                                "input": {
                                    "attributes": {
                                        "inputFormat": "ISO8601",
                                        "outputFormat": "ISO8601",
                                        "input": {
                                            "attributes": {
                                                "attributeName": "startDate",
                                                "sourceName": "NELM"
                                            },
                                            "type": "accountAttribute"
                                        }
                                    },
                                    "type": "dateFormat"
                                },
                                "expression": "-5d/d",
                                "roundUp": false
                            },
                            "type": "dateMath"
                        }
                    }
                }
            },
            "type": "dateCompare"
        },
        "value": "$fiveDaysOut"
    },
    "internal": false
}

I basically copied an existing transform and made simple changes to it as to the source, and attribute. I was using the working transform to calculate a lifecycle state for a prehire to allow an active account 5 days ahead of the start date.

I validated that the attribute value name is correct, the source name is correct and that the value is populated. The value is:
2020-03-24T05:00:00Z

In your transform, for outer dateFormat Input is output of dateMath and you have specified inputFormat as ISO8601. As you can see below, output of dateMath is not ISO8601, but “yyyy-MM-dd’T’HH:mm”

Change the inputFormat to match above ("inputFormat": "yyyy-MM-dd'T'HH:mm") and try

2 Likes

Thank you, this worked great.

My assumption is that we should be using the explicit SimpleDateFormat syntax rather than the built-in “named” constructs.

I have been using transforms for a long time and they don’t cease to surprise me. I have learnt a hard way that it is better to specify everything explicitly rather than to expect it to behave what seems logical :smile:

PS: If my response helped you solve your issue, would you mind marking it as a Solution? :grimacing:

1 Like

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