Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: How to use Centralized updates with master-detail and custom-generated key?


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


Permlink Replies: 1 - Last Post: Nov 2, 2015 8:13 AM Last Post By: Francisco Arman...
Francisco Arman...

Posts: 11
Registered: 3/3/01
How to use Centralized updates with master-detail and custom-generated key?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 27, 2015 4:29 AM
Hi I ave read some documentation of how to use Master-detail relationship using the centralized cached updates.
But what happens if the master key is an generated value that I get from an stored procedure, lets says I use in MySQL my own mechanism to use a kind of 'Sequencers', for that I use a stored function, so, some examples says I can the the OnUpdateRecordEvent, but how can I assign that new value to the field before it is posted so it will be reflected after an 'applyupdates'?

I saw in an doc example you use in a UpdateRecord event

ASender['tmstamp'] := FDQuery2.Params[3].Value;

but that 'ASender['tmstamp']' assignment sometimes will fail, sending the 'dataset not in edit mode' or the FireDAC error 'Cannot begin edit row'

so what can be the best way to achieve this, so the master key can be propagated to detail datasets?

Edited by: Francisco Armando Dueñas Rodriguez on Oct 27, 2015 4:30 AM
Francisco Arman...

Posts: 11
Registered: 3/3/01
Re: How to use Centralized updates with master-detail and custom-generated key?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 2, 2015 8:13 AM   in response to: Francisco Arman... in response to: Francisco Arman...
Any Ideas?

Francisco Armando Dueñas Rodriguez wrote:
Hi I ave read some documentation of how to use Master-detail relationship using the centralized cached updates.
But what happens if the master key is an generated value that I get from an stored procedure, lets says I use in MySQL my own mechanism to use a kind of 'Sequencers', for that I use a stored function, so, some examples says I can the the OnUpdateRecordEvent, but how can I assign that new value to the field before it is posted so it will be reflected after an 'applyupdates'?

I saw in an doc example you use in a UpdateRecord event

ASender['tmstamp'] := FDQuery2.Params[3].Value;

but that 'ASender['tmstamp']' assignment sometimes will fail, sending the 'dataset not in edit mode' or the FireDAC error 'Cannot begin edit row'

so what can be the best way to achieve this, so the master key can be propagated to detail datasets?

Edited by: Francisco Armando Dueñas Rodriguez on Oct 27, 2015 4:30 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02