Hoppa till huvudinnehållet

Assign Null Dates to an Attribute

Kommentarer

7 kommentarer

  • Kevin Penner
    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
  • Dan Griffin
    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
  • Kevin Penner
    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.

     

    -Kevin
    0
  • Dan Griffin
    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
  • Kevin Penner
    Hi Dan,

     

    Have you tried the keyword 'Nothing' instead of 'Null' when working with VB expressions in Workflow Designer?

     

    -Kevin
    0
  • Kevin Penner
    Ps. For checking strings use String.IsNullOrEmpty(appRefundDate). This will equal 'True' if the string is empty or null/nothing.
    0
  • Dan Griffin
    Got it.  CStr(nothing) 

     

    Thanks again!
    0

Du måste logga in om du vill lämna en kommentar.