Assign Null Dates to an Attribute
Just wondering how to go about assigning null dates to an attribute in a workflow?
Currently, I have:
item.Attributes("Refund_DD_Date") = cdate(appRefundDate.toString).AddHours(+8)
But this doens't work if the date value is null.
0
-
There may be a few things going on. First, make sure to check that 'appRefundDate' is not Nothing. CAlling ToString() on a null value will throw an error. You can also test 'item.Attributes("Refund_DD_Date") = Nothing' and try saving that to see if ArcGIS will accept null values for that field. Looking at the fields information on the layers enpoint will also tell you if null values are accepted for Refund_DD_Date. 0 -
Thanks Kevin. I am getting a string to date conversion error for null values. Null values are accepted in the date field.
I gave this a try but it didn't work either:
cdate(System.DateTime.MinValue.toString)0 -
Hi Dan,
What is it you are trying to do exactly? Parse a date from a string? Assuming this is what you want and the string is not null, you should be able to do this (https://stackoverflow.com/questions/5366285/parse-string-to-datetime-in-c-sharp) . It can sometimes be a headache. I suggest you use lots of logging and don't try to one line it.
Let us know how it goes.
-Kevin0 -
Basically, I just want to check if the date is empty. (thanks for pointing out that it's not nothing). If it is emplty then assign <Null> to the attribute.
I have an if condition appRefundDate.toString = ("") working but I can't figure out how to assign <Null> to the attribute.0 -
Hi Dan,
Have you tried the keyword 'Nothing' instead of 'Null' when working with VB expressions in Workflow Designer?
-Kevin0 -
Ps. For checking strings use String.IsNullOrEmpty(appRefundDate). This will equal 'True' if the string is empty or null/nothing. 0 -
Got it. CStr(nothing)
Thanks again!0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
7 kommentarer