![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Mon, Jun 18 2018 12:12 AM | Permanent Link |
Frederick Chin | When a date field is NULL in a DBISAM table, storing it to the date field of another table, results in the target date field having a value of 01/01/1970.
For example, targetDS.Columns['date'].asDateTime:=sourceDS.Columns['date'].asDateTime; Is it possible to have the target field to also have a NULL value or a date of 31/12/1899 like Delphi? In Delphi, I normally clear the field if the date is earlier than 01/01/1900 but in EWB, I can't apply the same logic because 01/01/1970 may be a valid date. -- Frederick |
Mon, Jun 18 2018 2:53 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Frederick,
<< When a date field is NULL in a DBISAM table, storing it to the date field of another table, results in the target date field having a value of 01/01/1970. For example, targetDS.Columns['date'].asDateTime:=sourceDS.Columns['date'].asDateTime; Is it possible to have the target field to also have a NULL value or a date of 31/12/1899 like Delphi? >> Sure, but you'll have to check for it and call Clear on the target dataset's column so that it also becomes NULL, like this: if sourceDS.Columns['date'].Null then targetDS.Columns['date'].Clear else targetDS.Columns['date'].asDateTime:=sourceDS.Columns['date'].asDateTime; However, I think I need to add an Assign method for the TDataColumn class, otherwise this could get a little verbose over time. Tim Young Elevate Software www.elevatesoft.com |
Mon, Jun 18 2018 9:02 PM | Permanent Link |
Frederick Chin | Tim,
/* Sure, but you'll have to check for it and call Clear on the target dataset's column so that it also becomes NULL, like this: if sourceDS.Columns['date'].Null then targetDS.Columns['date'].Clear else targetDS.Columns['date'].asDateTime:=sourceDS.Columns['date'].asDateTime; */ I store the value for the sourceDS into a variable and pass it to a procedure but the value of the variable is set to 01/01/1970 when the source field is null. If possible, I would like the value to be set by EWB to 31/12/1899 (like in Delphi) if a null field is detected, like varDate:=sourceDS.Columns['date'].asDateTime; // Should be 31/12/1899 and not 01/01/1970 if field is null so that I can use the code below:- if varDate>StrToDate('31/12/1899') then targetDS.Columns['date'].asDateTime:=varDate else // Do nothing -- Frederick |
Fri, Jun 22 2018 4:01 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Frederick,
<< If possible, I would like the value to be set by EWB to 31/12/1899 (like in Delphi) if a null field is detected, like >> It *will* be once it cross the network connection and lands in some Delphi code on the web server side. What you're looking at is a peculiarity of the differences between a "zero" date/time in JS vs. a "zero" date/time in Delphi. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Saturday, June 3, 2023 at 10:17 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |