Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Using SQL functions while editing dataset


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Mar 19, 2017 11:36 PM Last Post By: Dmitry Arefiev
Waldemar Misiur...

Posts: 5
Registered: 11/17/12
Using SQL functions while editing dataset  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 17, 2017 3:50 AM
I've got this FDQuery in edit mode:
FDQUser->Edit();
FDQUser->FieldByName("u_active_from")->AsDateTime=DateOf(Now());
FDQUser->Post();


Is there a way ( and how to achieve it) to insert Server function or expression here like : Now() or clock_timestamp() etc. ?
I would like server "Now()" instead of user PC "now()" there.
I'd rather not use Query here like :

FDQUser->SQL->Text="update t_users set u_active_from= Now() where...";

or
FDQOther->SQL->Text="select Now() ";


I'd like to avoid using additional resources for querying server every time i need Server timestamp,
I had proposals to use TFDUpdateSql or even triggers but sometimes it has to be clientside "now" and sometimes serverside,
Getting Server Timestamp once and calculating offset from localtime is not an option also, since users have to perform certain tasks
at due time, and simply changing PC date or/and time would allow them to change this to whatever.
TFDUpdateSql kinda solves this but i'd have to prepare modified update queries for every possible dataset i am using.
Is there some simpler way ?

Kind regards
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Using SQL functions while editing dataset  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 19, 2017 11:36 PM   in response to: Waldemar Misiur... in response to: Waldemar Misiur...
Is there some simpler way ?

No.

--
With best regards,
Dmitry
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02