I am getting the following error If: Object reference not set to an instance of an object. Attached my excel file and workflow for reference . Can anyone help me in knowing why the error is coming
The error is in the condition of the If statement. That’s why the initial error says If:
The “object reference not set to an instance of an object” error means you’re trying to use a variable or other expression that doesn’t exist. For example, ColumnDisc(“hello”) but there’s no key named “hello” in ColumnDisc.
You have a very complicated statement there. Are you sure that’s all necessary? I would recommend doing conversions etc ahead of time to simplify that statement. Don’t do it all in one line - this makes debugging a nightmare.
Thanks Paul. If I want to convert any date format to {“M/d/yyyy”,“M-d-yyyy”,“MM/dd/yyyy”,“MM-dd-yyyy”},System.Globalization.CultureInfo.InvariantCulture).ToString(“ddMMyyyy”) how to do the conversions before hand. shall i assign a variable and do the conversions and then replace it in the if condition? Can you help in this?
Create a string variable and use an Assign activity to assign the converted value to the variable. Then in the If condition replace the conversion expression with the variable.