Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: TFDQuery master/detail with cached updates without using TDataSource


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


Permlink Replies: 10 - Last Post: Jun 10, 2016 4:26 PM Last Post By: Asbjørn Heid
Asbjørn Heid

Posts: 267
Registered: 11/12/12
TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 19, 2016 3:50 AM
Hi,

I want to use TFDQuery master/detail with cached updates, which from what I understand requires a TFDSchemaAdapter.

Is there a way to use TFDQuery master/detail with cached updates without using the fundamentally broken TDataSource-based master/detail link (ie MasterSource)?

I know I can use TClientDataSet and TDataSetProvider against a single (live) TFDQuery, but I'd prefer to avoid that if I can.

Cheers
- Asbjørn
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 19, 2016 7:33 AM   in response to: Asbjørn Heid in response to: Asbjørn Heid
On Thu, 19 May 2016 03:50:08 -0700, Asbj?rn Heid <> wrote:

Is there a way to use TFDQuery master/detail with cached updates without using the fundamentally broken TDataSource-based master/detail link (ie MasterSource)?

sorry, not the answer to your question but could you please elaborate on what is fundamentally broken in TDataSource-based master/detail
link?

thank you

--
Vladimir Ulchenko aka vavan
Asbjørn Heid

Posts: 267
Registered: 11/12/12
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 19, 2016 7:52 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Vladimir Ulchenko wrote:

sorry, not the answer to your question but could you please elaborate on what is fundamentally broken in TDataSource-based master/detail
link?

Primarily that DisableControls breaks the master/detail synchronization.

Cheers
- Asbjørn
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 19, 2016 11:54 PM   in response to: Asbjørn Heid in response to: Asbjørn Heid
Primarily that DisableControls breaks the master/detail synchronization.

http://docwiki.embarcadero.com/Libraries/Berlin/en/FireDAC.Comp.DataSet.TFDMasterDataLink.Synchronize

--
With best regards,
Dmitry
Asbjørn Heid

Posts: 267
Registered: 11/12/12
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 20, 2016 12:43 AM   in response to: Dmitry Arefiev in response to: Dmitry Arefiev
Dmitry Arefiev wrote:
Primarily that DisableControls breaks the master/detail synchronization.

http://docwiki.embarcadero.com/Libraries/Berlin/en/FireDAC.Comp.DataSet.TFDMasterDataLink.Synchronize

Mkay, that could work.

Since I do not want to special-case the FD datasets in my processing methods, I guess I'll have to stuff that into the master's OnScroll and such events?

Cheers
- Asbjørn
Asbjørn Heid

Posts: 267
Registered: 11/12/12
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 10, 2016 4:25 PM   in response to: Asbjørn Heid in response to: Asbjørn Heid
Asbjørn Heid wrote:
Dmitry Arefiev wrote:
Primarily that DisableControls breaks the master/detail synchronization.

http://docwiki.embarcadero.com/Libraries/Berlin/en/FireDAC.Comp.DataSet.TFDMasterDataLink.Synchronize

Mkay, that could work.

Since I do not want to special-case the FD datasets in my processing methods, I guess I'll have to stuff that into the master's OnScroll and such events?

So what I ended up with was to take the core code behind Synchronize and make a new method out of it, so that I can call it on the master and it would update all the detail tables. Basically it just calls GetDetailDataSets() and then calls MasterLink.Synchronize(True) on those. I then call it after doing .Next() etc.

This way I don't need to know about all the detail datasets in the place that iterates over the master.

Cheers
- Asbjørn
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 20, 2016 3:05 AM   in response to: Asbjørn Heid in response to: Asbjørn Heid
On Thu, 19 May 2016 07:52:15 -0700, Asbj?rn Heid <> wrote:

Primarily that DisableControls breaks the master/detail synchronization.

doesn't BlockReadSize help?

--
Vladimir Ulchenko aka vavan
Asbjørn Heid

Posts: 267
Registered: 11/12/12
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 20, 2016 3:40 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Vladimir Ulchenko wrote:
On Thu, 19 May 2016 07:52:15 -0700, Asbj?rn Heid <> wrote:

Primarily that DisableControls breaks the master/detail synchronization.

doesn't BlockReadSize help?

It helps for FireDAC, but TClientDataSet has a bug where not all columns are refreshed when scrolling if BlockReadSize is non-zero.

Also, I think it looks hackish, so would prefer not to use it.

- Asbjørn
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 20, 2016 7:18 AM   in response to: Asbjørn Heid in response to: Asbjørn Heid
On Fri, 20 May 2016 03:40:29 -0700, Asbj?rn Heid <> wrote:

It helps for FireDAC, but TClientDataSet has a bug where not all columns are refreshed when scrolling if BlockReadSize is non-zero.

could you please shed some light on this bug? thank you

Also, I think it looks hackish, so would prefer not to use it.

being described in the help topic for DisableControls method as "Setting BlockReadSize instead of calling DisableControls updates the detail
datasets as you scroll through the dataset, but does not update data-aware controls" it doesn't look hackish to me but I must admit I rarely
used it to be definitive

--
Vladimir Ulchenko aka vavan
Asbjørn Heid

Posts: 267
Registered: 11/12/12
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 20, 2016 7:32 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Vladimir Ulchenko wrote:
On Fri, 20 May 2016 03:40:29 -0700, Asbj?rn Heid <> wrote:

It helps for FireDAC, but TClientDataSet has a bug where not all columns are refreshed when scrolling if BlockReadSize is non-zero.

could you please shed some light on this bug? thank you

Well, at least TBooleanField does not seem to be updated on scrolling (ie Next/Prior), so it contains stale data. Integer and string fields seems fine though. I'm going to make a QP report when I have time, hopefully this weekend.

Also, I think it looks hackish, so would prefer not to use it.

being described in the help topic for DisableControls method as "Setting BlockReadSize instead of calling DisableControls updates the detail
datasets as you scroll through the dataset, but does not update data-aware controls" it doesn't look hackish to me but I must admit I rarely
used it to be definitive

Well, based on the name and how it changes scrolling, the fact that it can work as an alternative for DisableControls seems to be a side-effect rather than a primary purpose. That's why I'd rather not rely on it, because maybe the primary purpose bites me some other day in the future.

Cheers
- Asbjørn
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: TFDQuery master/detail with cached updates without using TDataSource  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 23, 2016 12:57 AM   in response to: Asbjørn Heid in response to: Asbjørn Heid
On Fri, 20 May 2016 07:32:54 -0700, Asbj?rn Heid <> wrote:

Well, at least TBooleanField does not seem to be updated on scrolling (ie Next/Prior), so it contains stale data. Integer and string fields seems fine though. I'm going to make a QP report when I have time, hopefully this weekend.

please report back ticket number here
basically I only use AnyDAC on server/provider side and cds descendant on client side so cds based test project preferred

Well, based on the name and how it changes scrolling, the fact that it can work as an alternative for DisableControls seems to be a side-effect rather than a primary purpose

not sure I understood this

--
Vladimir Ulchenko aka vavan
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02