Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   [SOLVED] dataset calculated field (http://www.delphipages.com/forum/showthread.php?t=217722)

FreakaZoid2 01-18-2018 10:40 PM

dataset calculated field
 
I have a firedac query that returns a column C_08 but I want to add a new column not in the table but just on the fly of the query.
I am trying to figure out how to add a new column D_08 and to assign the value from C_08 to D_08.
It has to be calculated. this is related to prior timestamp/datetime fieldtype question. C_08 is timestamp and the component doesn't work on it so I need to create the new column D_08 as a datetime field type and set its value to the same as C_08
I added it as a InternalCalc and set the defaultexpression to C_08. compiles but my new column is always null
What am I missing.

Norrit 01-19-2018 08:34 AM

Code:

SELECT
  Convert(DATETIME, [C_08]) as [D_08]
FROM [yourtable]


FreakaZoid2 01-19-2018 02:26 PM

sorry rest of the story...
 
It has to be a calculated field because I am using an Access database and when I open the query and check the field type it is timestamp and if in the query I use the CDATE command to create my new field it still comes out as timestamp. the calculated field comes out as datetime but is null.
this is a big round robin type of setup.
a firedac query to a datasetprovider to a clientdataset. when I add the field to the FDQuery it gets set properly and is a datetime field. but in the clientdataset the field is null. if I add it the fdquery and clientdataset then I get an error of name not unique. when I add it only to the clientdataset it is null.
I tried using maprules of firedac but it made no difference. it seems that timestamp is a datetime so no datatype conversion changes are made in the query.
So when playing around with the added field it says that it is a datetime but I just cant seem to get the clientdataset field to have a value.


All times are GMT. The time now is 12:57 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.