Transform to check dateless 5 days or not

Hi Team,

I am Trying to create transform to see start date is less than 5 days or not somehow its not working can some point what I am doing wrong here

{
    "name": "startDateCompare",
    "type":"static",
    "attributes": {
        "5DayCheck": {
            "type": "dateCompare",
            "attributes": {
                "firstDate": {
                "type": "dateFormat",
                "attributes": {
                    "input": {
                    "type":"dateMath",
                    "attributes": {
                        "expression": "now-5d"
                    }
                },
                "inputFormat": "yyyy-MM-dd'T'HH:mm",
                "outputFormat": "ISO8601"
            }
        },
        "secondDate": {
            "type": "dateFormat",
            "attributes": {
                "input": {
                    "type": "accountAttribute",
                    "attributes": {
                        "sourceName": "TestSourceforjoiner",
                        "attributeName": "HIREDATE"
                    }
                },
                "inputFormat": "MM/dd/yyyy",
                "outputFormat": "ISO8601"
            }
        },
        "operator": "lte",
        "positiveCondition": "true",
        "negativeCondition": "false"
    }
},
"value": "#if($5DayCheck=='true')start#{else}notstart#end"
    }
}

Hello @learningiam,

Welcome to the developer community!

It looks like the transform evaluator has an issue with variables starting with a number in the value key.

If you change your variable name to fiveDayCheck instead of 5DayCheck you will get a value back.

{
	"name": "startDateCompare",
	"type": "static",
	"attributes": {
		"fiveDayCheck": {
			"type": "dateCompare",
			"attributes": {
				"firstDate": {
					"type": "dateFormat",
					"attributes": {
						"input": {
							"type": "dateMath",
							"attributes": {
								"expression": "now-5d"
							}
						},
						"inputFormat": "yyyy-MM-dd'T'HH:mm",
						"outputFormat": "ISO8601"
					}
				},
				"secondDate": {
					"type": "dateFormat",
					"attributes": {
						"input": {
							"type": "accountAttribute",
							"attributes": {
								"sourceName": "TestSourceforjoiner",
								"attributeName": "HIREDATE"
							}
						},
						"inputFormat": "MM/dd/yyyy",
						"outputFormat": "ISO8601"
					}
				},
				"operator": "lte",
				"positiveCondition": "true",
				"negativeCondition": "false"
			}
		},
		"value": "#if($fiveDayCheck=='true')start#{else}notstart#end"
	}
}
1 Like