Normal Topic Date Value for empty fields with xResultSet   (Read 961 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Date Value for empty fields with xResultSet  
Mar 22nd, 2010 at 2:51am
Print Post Print Post  
I have two text elements bound to Date fields on the same layout. When I get the values from both the fields and both of them are empty by the following code.

vRSHandle = @XResultSetSearch(@FN, "Index", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!RecNumber=" + RecNumber)
     if(vRSHandle > -1)
     {
                 ResultsetCurrentPosition (vRSHandle, 1)
                             
                 vLastLead = @XResultSetValue(vRSHandle, "Last_Lead")
                 WriteLN ("Last Lead Level = " + vLastLead )
                                               
                 vLastLab = @XResultSetValue(vRSHandle, "Last_Lab")
                 WriteLN ("Last Lab Done = " + vLastLab)

           XResultSetClose(vRSHandle)
     }

vLastLead = 0000/00/00
vLastLab =      (Null)

If I place some date in both the elements, both of them retrieve the values properly, only the different behavior with Null value.

What make them inconsistent? Properties of both the elements and fields are identical and both belong to the same database and layout. Computer actions are seldom random, what make them to behave differently? Which one is the expected behavior and which one is aberrant?

Please help me to understand this. Thanks.
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Date Value for empty fields with xResultSet  
Reply #1 - Mar 22nd, 2010 at 4:51am
Print Post Print Post  
I tried the xlookup command for the same and got the identical results as my previous post.

var vLastlab as String
var vLastLead as String

vLastLab = @Xlookup (@FN, RecNumber, "Tracker!RecNumber", "Last_Lab")
WriteLN ("This is the value for Last_Lab: " + vLastLab)

vLastLab = @Xlookup (@FN, RecNumber, "Tracker!RecNumber", "Last_Lead")
WriteLN ("This is the value for Last_Lead: " + vLastLab)

The Slate Shows results as follows:

This is the value for Last_Lab:
This is the value for Last_Lead: 0000/00/00

Apparently everything about the two elements are the same but as such it could not be... which property would explain thsese different  results of the same command?
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Date Value for empty fields with xResultSet  
Reply #2 - Mar 22nd, 2010 at 12:41pm
Print Post Print Post  
I looked into it further to find out what is rule and what is exception. Here is what I found.

vLastLab = @Xlookup (@FN, RecNumber, "Tracker!RecNumber", "Last_Lab")
WriteLN ("This is the date value for Blank Last_Lab: " + vLastLab)


vLastLab = @Xlookup (@FN, RecNumber, "Tracker!RecNumber", "Last_Lead")
WriteLN ("This is the date value for Blank Last_Lead: " + vLastLab)


vLastPap = @Xlookup (@FN, RecNumber, "Tracker!RecNumber", "Last_PapDate")
WriteLN ("This is the date value for Blank Last_PapDate: " + vLastPap)


vLastMammogramOrderDate = @Xlookup (@FN, RecNumber, "Tracker!RecNumber", "Ordered_Date")
WriteLN ("This is the date value for Blank Memmogram Order Date: " + vLastMammogramOrderDate)


vDTaP5 = @Xlookup (@FN, RecNumber, "Immunization!RecNumber", "DTaP5")
WriteLN ("This is the Date value for Blank DTaP5: " + vDTaP5)

vMMR2 = @Xlookup (@FN, RecNumber, "Immunization!RecNumber", "MMR2")
WriteLN ("This is the Date value for Blank MMR2: " + vMMR2)

The Slate display following results:

This is the date value for Blank Last_Lab:
This is the date value for Blank Last_Lead: 0000/00/00
This is the date value for Blank Last_PapDate: 0000/00/00
This is the date value for Blank Memmogram Order Date: 0000/00/00
This is the Date value for Blank DTaP5:
This is the Date value for Blank MMR2:

It is 3 and 3 even.  They are very consistent in the results - meaning the same field gives the same result when performed repeatedly.  Only thing that might differ as to when the fields were created. I have been using Sesame from version 1.0 to 2.5. I believe the newly created Date field gives Null results but I could be wrong in my this assessment.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Date Value for empty fields with xResultSet  
Reply #3 - Mar 22nd, 2010 at 2:14pm
Print Post Print Post  
How are the variables that are receiving the date values declared? If a string variable receives an empty string it will display as a string with no length. But a date variable will display as the zero date ("0000/00/00"). Also, how are you initializing the dates in the external application/database? Were they initialized by a  user, initial value, or SBasic programming?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Date Value for empty fields with xResultSet  
Reply #4 - Mar 22nd, 2010 at 2:27pm
Print Post Print Post  
Quote:
How are the variables that are receiving the date values declared? If a string variable receives an empty string it will display as a string with no length. But a date variable will display as the zero date ("0000/00/00"). Also, how are you initializing the dates in the external application/database? Were they initialized by a  user, initial value, or SBasic programming?


All the variables used are the string variables.  like

var vLastlab as String
var vLastLead as String

Quote:
If a string variable receives an empty string it will display as a string with no length.


From some fields String Variable is getting empty string while from other it is getting "0000/00/00/" and that seems to be the problem.

Quote:
Also, how are you initializing the dates in the external application/database? Were they initialized by a  user, initial value, or SBasic programming?


The date values were initialized by the programming generally.  Since the value is blank in the external database from which value is retrieved, it was not initialized, I suppose.

I believe the newly created Date field with version 2.0 and after gives Null results while the fields created with earlier versions is giving "0000/00/00" string to the string variable for the blank value but I could be wrong in my this assessment.
  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Date Value for empty fields with xResultSet  
Reply #5 - Mar 22nd, 2010 at 5:19pm
Print Post Print Post  
Bharat_Naik wrote on Mar 22nd, 2010 at 12:41pm:
I have been using Sesame from version 1.0 to 2.5. I believe the newly created Date field gives Null results but I could be wrong in my this assessment.


There was a fix that allowed date fields to hold a blank value, as opposed to a "zero date". You may be seeing this. I have not found another way to produce the results you are seeing without using date variables.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged