CA Gen COM proxy displays NULL DATE as a time "12:00:00 AM"
search cancel

CA Gen COM proxy displays NULL DATE as a time "12:00:00 AM"

book

Article ID: 193080

calendar_today

Updated On:

Products

Gen Gen - Run Time Distributed

Issue/Introduction

Deploying a Gen 8.6 COM Proxy .ASP file, we are surprised that a date field (not timestamp field) containing a NULL value (00000000) returned from the Gen server is displayed with a time value "12:00:00 AM". Can you please explain further.

Environment

Release : 8.6 (not release dependent - the behaviour is not specific to Gen)
Component : CA Gen Generator, Proxy

Resolution

Support recreated the behaviour as follows. 2 date fields, one with a populated date and one with a null date:

Firstly it should be noted that the generated .ASP file is just sample generated code that must be customised to meet specific requirements.
This behaviour is working as expected as follows:
The VB data type DATE, which Gen uses for a COM Proxy date attribute, contains both date and time components and when the date is the zero date the default display format still shows the time i.e. "12:00:00 AM" (midnight).

Using their test model support changed the .ASP file to force the display of null for a zero date (when the value is "12:00:00 AM") i.e.
CHANGED:
        response.write "<TD><h4>" & OutWs1Date1_form_name & "</h4></TD>" & vblf
        response.write "<TD>" & op.OutWs1Date1 & "</TD></TR>" & vblf
        response.write "<TR><TD><h3>Ws1</h3></TD></TR>" & vblf
        response.write "<TR><TD></TD>"
        response.write "<TD><h4>" & Out2Ws1Date1_form_name & "</h4></TD>" & vblf
        response.write "<TD>" & op.Out2Ws1Date1 & "</TD></TR>" & vblf

TO:
        response.write "<TD><h4>" & OutWs1Date1_form_name & "</h4></TD>" & vblf
        If op.OutWs1Date1 <> "12:00:00 AM" Then
          response.write "<TD>" & op.OutWs1Date1 & "</TD></TR>" & vblf
        Else
         response.write "NULL"
        End If
        response.write "<TR><TD><h3>Ws1</h3></TD></TR>" & vblf
        response.write "<TR><TD></TD>"
        response.write "<TD><h4>" & Out2Ws1Date1_form_name & "</h4></TD>" & vblf
        If op.Out2Ws1Date1 <> "12:00:00 AM" Then
          response.write "<TD>" & op.Out2Ws1Date1 & "</TD></TR>" & vblf
        Else
          response.write "NULL"
        End If

The result was that no value is then displayed for the null date field:



The above example can be adapted to force whatever the value is required to be displayed when the date is NULL/zero.