ubanide

normalize date in python

Discussion created by ubanide on Nov 3, 2011
Latest reply on Nov 4, 2011 by b_e_n
My Management has directed that I normalize some of our tables. So I have to add some new fields.  OK done.  One of the new fields is Incident_date.  Well  existing is a field called report date.  About half of those fields are NULL.  There is also a field call create_date. So what I want to do is if the report date has data I want to use that, if not then I want to use create_date.

So I fired up calculate field. Selected the table and selected Incident as the field.  Clicked on Python, and entered:

def CalIncident(Repdat, CrteDat):
  if ( Repdat == NULL) :
    return CrtDat
  else
    return Repdat



Other window
ReportDate =
CalIncident(!ReportDate!, !CreateDate!)

I don't think it understands NULL in this context.  Any idea what I should use?

Thanks

Outcomes