Workflow Soluiton

 View Only
  • 1.  Grid Displays null Date Values as 1/1/0001 12:00:00 AM

    Posted Apr 05, 2011 09:29 AM

    I am using a Web Grid component to display information about Loaner equipment to technicians.  Sometime the Date Loaned, Expected Return and Date Return in the DB are Null.  When the data displays in the grid it displays as 1/1/0001 12:00:00 AM instead of being blank.  What would cause this to happen?  I have other workflow that if the date is null it display a blank field in the grid.  I can't find what I have done differently in the DB or the way the grid is setup that would cause these differences.  Please see attached screenshot.



  • 2.  RE: Grid Displays null Date Values as 1/1/0001 12:00:00 AM

    Posted Apr 05, 2011 03:06 PM

    It's a limitation of how the grid displays datetime values.  I just ran into this a few weeks back

    DateTime fields are internally tracked using a very large integer value.  Each programming language and database treats things a bit differently, but they all define a date that represents an internal value of zero, and increase time according to the size of that internal value.   The result is that you get this confusing date when you didn't define one.

    If you are using a database query, you can try to convert the sql output from a datetime field to a text output (nvarchar for example).   For null values, substitute an empty string.

    Another option could be to define a custom datatype (in workflow) with the same fields as your original array, but swap text fields for the datetime fields.  Create a model that is responsible for doing the translation and outputing the array with the swapped datetime to text fields. Within the model, compare the datetime values to see if they are greater than 1/1/2001 12:00:00 AM and set the output string accordingly.  I believe there is also a checkbox on the time comparision components like "Minimum value"  that is the same datetime value discussed earlier.



  • 3.  RE: Grid Displays null Date Values as 1/1/0001 12:00:00 AM

    Posted Apr 05, 2011 03:34 PM

    I have another workflow that does the same thing but uses a different table as it is for a separate region in the country.  It does not display anything when the date times are null.  The only difference between these is that I'm using a table generator in the one that works and I using a query script generator in the one that doesn't

     



  • 4.  RE: Grid Displays null Date Values as 1/1/0001 12:00:00 AM

    Posted Apr 05, 2011 03:53 PM

    I'm frequently working on beta versions of WF, so my experience could be different that yours.  I don't really like the behavior (it's on my list of enhancement requests to submit).  Were your different projects created using different versions of WF?

    Other than that, I'd double check the datatypes for those fields and verify they are the same. There's also a nullable datetime type, but I recall it didn't make a change in the grid control, so I stopped using it.

    One other possibility, I vaguely recall a different grid behavior when populating a custom datatype array.  I think it had to do with manually assigning values within the same model, versus getting the array from an external webservice.  Workflow wouldn't send a null value for the datetime field, so it was substituting a zero instead.  So,  the short answer is, see if the behavior changes if you manually assign some array values within the same model.



  • 5.  RE: Grid Displays null Date Values as 1/1/0001 12:00:00 AM
    Best Answer

    Posted Apr 06, 2011 09:57 AM

    I put another grid on my form that is getting is data from a Table Generator component and the Date time fields now display a blank value when the date is null.  See Screenshot attached with the top grid using the quarry/Script Generator integration and the bottom one using the Table Generator component.

    So it seems that if you use the Table Generator to fill in your grid it will work correctly.  My SQL in my quarry/script generator is just select * from mytable.  I would assume it would be the same sql behind the Table Generator as I tell it to read all records from the table.  So I'm not sure what the difference is but if you using a DB to fill in your grid than this would be a work arround.