When writing a date to a DBF file field from a VO application, the DATE type is used.
Code: Select all
OVERRIDE METHOD PutValue(nFldPos AS INT, oValue AS OBJECT) AS LOGIC
...
SWITCH oField:FieldType
...
CASE DbFieldType.Date
// DATE
LOCAL dDate := (DATE)oValue AS DATE
...
The opposite is also true, reading the date from the DBF file returns us the DATE type packed into the USUAL type. But I noticed that inside X# RDD dates are treated as DbDate type. Then, when reading the field value, for example, with the VoDbFieldGet function, the value is returned through the USUAL type, where it is converted from DbDate type to the DATE type.
I have an RDD (SQL) in which I use the DATE type directly when working with dates (sample code above). Since the date value comes from the application to the IRDD:PutValue method as a DATE type (packed in OBJECT). But there was a problem with the TransRec method (default implementation from the base class Workarea). In the TransRec method, values are directly retrieved from the source RDD (GetValue method) and written to the target RDD (PutValue method), bypassing the packaging into the USUAL type. Thus, the date value comes into my RDD from DBFCDX RDD as a DbDate type. When I try to explicitly convert oValue (AS OBJECT) to DATE, an error occurs that this convertion is invalid.
What is the correct way to perceive this problem? In X#, the implicit or at least explicit convertion of the DbDate type to the DATE type is missing, or I need to take into account in my RDD that date values in the PutValue method can come not only as a DATE type, but also as a DbDate type, and the DbDate type cannot be converted to DATE type.
I think X# lacks the convertion of the related types DbDate and DATE. For example, DateTime can be converted to DATE.
Best regards,
Leonid