Handling a End date that is Blank

I have this transform below and want it to handle the end date if it is blank and not fail. “name”: “SB_NEXTDAYPROCESSING”,

"type": "dateMath",

"attributes": {

    "input": {

        "type": "firstValid",

        "attributes": {

            "values": \[

                {

                    "type": "dateFormat",

                    "attributes": {

                        "input": {

                            "type": "accountAttribute",

                            "attributes": {

                                "sourceName": "ARHSB-Passport Database",

                                "attributeName": "End_Date"

                            }

                        },

                        "inputFormat": "MM/dd/yyyy",

                        "outputFormat": "ISO8601"

                    }

                }

            \]

        }

    },

    "expression": "+36h"

},

"internal": false

}

Hi @dpowers1

Try using a first valid transform alongside your accountAttribute transform like this:

{
    "type": "dateMath",
    "attributes": {
        "input": {
            "type": "firstValid",
            "attributes": {
                "values": [
                    {
                        "type": "dateFormat",
                        "attributes": {
                            "input": {
                                "type": "firstValid",
                                "attributes": {
                                    "values": [
                                        {
                                            "type": "accountAttribute",
                                            "attributes": {
                                                "sourceName": "ARHSB-Passport Database",
                                                "attributeName": "End_Date"
                                            }
                                        },
                                        "12/31/9999"
                                    ],
                                    "ignoreErrors": false
                                }
                            },
                            "inputFormat": "MM/dd/yyyy",
                            "outputFormat": "ISO8601"
                        }
                    }
                ]
            }
        },
        "expression": "+36h"
    },
    "internal": false
}

Let me know if this helps!

Hi @dpowers1

{
  "name": "SB_NEXTDAYPROCESSING",
  "type": "firstValid",
  "attributes": {
    "ignoreErrors": true,
    "values": [
      {
        "type": "dateMath",
        "attributes": {
          "input": {
            "type": "dateFormat",
            "attributes": {
              "input": {
                "type": "accountAttribute",
                "attributes": {
                  "sourceName": "ARHSB-Passport Database",
                  "attributeName": "End_Date"
                }
              },
              "inputFormat": "MM/dd/yyyy",
              "outputFormat": "ISO8601"
            }
          },
          "expression": "+36h"
        }
      },
      ""
    ]
  },
  "internal": false
}

Basically transform is doing firstValid outer transform and ignoreErrors:true. Otherwise a blank end_date can still cause dateFormat/dateMath to fail.

Thanks

Thank you. I tried that and it didn’t fail when there was no end date

Thank you. I tried that and it didn’t fail when there was no end date

I’m glad that worked for you!

Have a nice day :slightly_smiling_face: