How to convert DateTimeConverter from (null)

I am reading excel cell value which contains Date and I have use the argument with System.DateTime type to store that value, but sometime that cell might be blank.
At that time BOT give me Exception as “DateTimeConverter cannot convert from (null).”
I have tries with String as Argument type also but that is also not working And if I used “NA” instead of blank that gives exception vise versa.
can someone please help to fix this.

You can use If condition For this

1 Like

@nilesh.mahajan, you need to use an If activity to check if your variable is empty and then it should move on otherwise if the value is not empty then it can do something…

Your condition could be like this:

For string variable
String.IsNullOrEmpty(YourStringVariable)
For DateTime variable
YourDateTimeVariable.HasValue

The above should return false if variable is not empty, and true if variable is empty

2 Likes

thnx for Reply buddy,

I have used If condition as per your suggestion but it is not resolve “DateTimeConverter cannot convert from (null).” Exception.
My BOT used to work correctly if there is any date value available, but if BOT found blank value there then it will throws the above exception.

@nilesh.mahajan Can you show the workflow Screenshot to check How you have designed the flow.

Below is the Excel template screen shot from where I used to read the data where some time date will be blank and some time date will be there, so if date will be there BOT works fine but if there is blank cell BOT give Exception.
image

image

Below is the screen shot where BOT used to read and assign the value.

@nilesh.mahajan I don’t think it’s a good way to directly assign a DateTime type variable for the Read Cell Output. Can you Change the type to String. Then we can Check if the String Data has value and then Convert the Value to a DateTime type.

1 Like

Hello, thnx for reply,
I have tried to convert the string variable data into System.DateTime variable but it give overload error.
can you please let me know how to assign string variable into DateTime.

@nilesh.mahajan Are you able to read the Cell Value using Read Cell and Store it in a String variable? If you are able to do it, Can you show the Value in the Variable using a Message Box?

Hi,
Only null value I can store into String variable if there is any value in cell that will give error as “String value cannot be converted into DateTime” and If I have change that variable as DateTime then that cell value will correctly stored, but if any null value is there then it give error as “DateTime Converter cannot convert from (null)”
In that cell sometime value will there or some it will be null

String Datatype - String value cannot be converted into DateTime
DateTime Datatype - DateTime Converter cannot convert from (null).
At the time of storing value itself give the error.

image

Myself also facing same issue is there any solution

Hi,
Yes I have solve this challange from my end. I have convert the string into Date format first and then save the same in another variable.
Below screenshot might help you. please try and let me know if any challange.

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