I'm trying to verify a value of type time exists before I create a new record. I've tried several methods to test if the value in the "end_time" field is Null, but none seems to work.
How do you test for a Null time value in a browse?
The documentation in the "Null Table Field Values" says if you want to test for a NULL time value use:
"fieldname" = 00/00/0000 12:00:00 00 am
That is the value that the Object Explorer shows in my application.
My code:
parentform:BROWSE2.Fetch_Last()
if (parentform:Browse2:End_Time.Value = 00/00/0000 12:00:00 00 am)
ui_msg_box("Info", "Value Found", UI_OK)
endif
This results in a "no such field" error.
To test that End_Time.Value existed, I tried the following:
parentform:BROWSE2.Fetch_Last()
if (parentform:Browse2:End_Time.Value = ctodt("08/05/0000 12:00:00 00 am"))
ui_msg_box("Info", "Value Found", UI_OK)
else
ui_msg_box("Info", "Value Not Found", UI_OK)
endif
No error from this, and it returned "Value Not Found", which was expected.
Next test:
parentform:BROWSE2.Fetch_Last()
if (parentform:Browse2:End_Time.Value = ctodt("00/00/0000 12:00:00 00 am"))
ui_msg_box("Info", "Value Found", UI_OK)
else
ui_msg_box("Info", "Value Not Found", UI_OK)
endif
Resulted in the error "Not a valid time format."
Since it said the default null time was not a valid time format, I thought I'd test to see if the value in the field was not valid, and go based on that.
if(IsTime(parentform:Browse2:End_Time.Value))
ui_msg_box("Info", "Value Found", UI_OK)
else
ui_msg_box("Info", "Value Not Found", UI_OK)
endif
This resulted in the error "Variable is of different type."
I've run out of ideas. What simple thing have I missed that will see if the time field is null?
Tony
How do you test for a Null time value in a browse?
The documentation in the "Null Table Field Values" says if you want to test for a NULL time value use:
"fieldname" = 00/00/0000 12:00:00 00 am
That is the value that the Object Explorer shows in my application.
My code:
parentform:BROWSE2.Fetch_Last()
if (parentform:Browse2:End_Time.Value = 00/00/0000 12:00:00 00 am)
ui_msg_box("Info", "Value Found", UI_OK)
endif
This results in a "no such field" error.
To test that End_Time.Value existed, I tried the following:
parentform:BROWSE2.Fetch_Last()
if (parentform:Browse2:End_Time.Value = ctodt("08/05/0000 12:00:00 00 am"))
ui_msg_box("Info", "Value Found", UI_OK)
else
ui_msg_box("Info", "Value Not Found", UI_OK)
endif
No error from this, and it returned "Value Not Found", which was expected.
Next test:
parentform:BROWSE2.Fetch_Last()
if (parentform:Browse2:End_Time.Value = ctodt("00/00/0000 12:00:00 00 am"))
ui_msg_box("Info", "Value Found", UI_OK)
else
ui_msg_box("Info", "Value Not Found", UI_OK)
endif
Resulted in the error "Not a valid time format."
Since it said the default null time was not a valid time format, I thought I'd test to see if the value in the field was not valid, and go based on that.
if(IsTime(parentform:Browse2:End_Time.Value))
ui_msg_box("Info", "Value Found", UI_OK)
else
ui_msg_box("Info", "Value Not Found", UI_OK)
endif
This resulted in the error "Variable is of different type."
I've run out of ideas. What simple thing have I missed that will see if the time field is null?
Tony
Comment