Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 01-18-2018, 10:40 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 314
Default 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.
  #2  
Old 01-19-2018, 08:34 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,245
Default

Code:
SELECT 
  Convert(DATETIME, [C_08]) as [D_08]
FROM [yourtable]
  #3  
Old 01-19-2018, 02:26 PM
FreakaZoid2 FreakaZoid2 is offline
Senior Member
 
Join Date: Jul 2009
Posts: 314
Default 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.
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:44 PM.


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