Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-01

Master-detail-subdetail

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Koenraad Lelong

Hi,

I have a database (firebird) with master-data, detail-data and sub-detail-data.
In lazarus 0.9.28.2, svn 22279, I defined a TIBConnection, a TSQLTransaction and three TSQLQuery's. The detail has as its datasource a datasource coupled with the master. The subdetail has as its datasource a datasource coupled with the detail.
To show the data I have three TDBGrids, their datasources are those three datasources coupled with the three queries.

When I start the application, the master that shows has several details, each having several sub-details. When I scroll the details, the subdetails follow the detail. That's good. But when I scroll the master, only the details follow, the subdetail-grid goes blank.

To try finding what happens I added a button that opens the sub-detail-query. If I click on it I get the expected subdetails. When I scroll the master again, the subdetail disappears again. Again I can get it back by clicking my debug-button.

To debug this further, I added events for beforescroll, afterscroll, beforeclose and beforeopen for all three queries which write to a logfile. It seems that the beforeclose event is not fired for the subdetail-query, although it is closed somehow.

I hope this makes sense to someone. Is there anything I'm missing ? Or have I found a bug ?
If you need more info, please ask.

TIA

Regards,

Koenraad Lelong.

Reply by email

Unknown author
to Koenraad Lelong
Koenraad Lelong wrote 28 lines
Hi, I have a database (firebird) with master-data, detail-data and sub-detail-data. In lazarus 0.9.28.2, svn 22279, I defined a TIBConnection, a TSQLTransaction and three TSQLQuery's. The detail has as its datasource a datasource coupled with the master. The subdetail has as its datasource a datasource coupled with the detail. To show the data I have three TDBGrids, their datasources are those three datasources coupled with the three queries. When I start the application, the master that shows has several details, each having several sub-details. When I scroll the details, the subdetails follow the detail. That's good. But when I scroll the master, only the details follow, the subdetail-grid goes blank. To try finding what happens I added a button that opens the sub-detail-query. If I click on it I get the expected subdetails. When I scroll the master again, the subdetail disappears again. Again I can get it back by clicking my debug-button. To debug this further, I added events for beforescroll, afterscroll, beforeclose and beforeopen for all three queries which write to a logfile. It seems that the beforeclose event is not fired for the subdetail-query, although it is closed somehow. I hope this makes sense to someone. Is there anything I'm missing ? Or have I found a bug ?

There is no principle difference between the master/detail and the detail/subdetail relation, so I'd expect your setup to work.

Can you check whether the AfterScroll events occur for master/detail/subdetail ?

Michael.

Reply by email

patspiper
to Unknown author
Show quoted text 40 lines
On Tue, 4 Jan 2011, Koenraad Lelong wrote: > Hi, > > I have a database (firebird) with master-data, detail-data and > sub-detail-data. > In lazarus 0.9.28.2, svn 22279, I defined a TIBConnection, a > TSQLTransaction and three TSQLQuery's. The detail has as its datasource > a datasource coupled with the master. The subdetail has as its > datasource a datasource coupled with the detail. > To show the data I have three TDBGrids, their datasources are those > three datasources coupled with the three queries. > > When I start the application, the master that shows has several details, > each having several sub-details. When I scroll the details, the > subdetails follow the detail. That's good. But when I scroll the master, > only the details follow, the subdetail-grid goes blank. > > To try finding what happens I added a button that opens the > sub-detail-query. If I click on it I get the expected subdetails. When I > scroll the master again, the subdetail disappears again. Again I can get > it back by clicking my debug-button. > > To debug this further, I added events for beforescroll, afterscroll, > beforeclose and beforeopen for all three queries which write to a > logfile. It seems that the beforeclose event is not fired for the > subdetail-query, although it is closed somehow. > > I hope this makes sense to someone. Is there anything I'm missing ? Or > have I found a bug ? There is no principle difference between the master/detail and the detail/subdetail relation, so I'd expect your setup to work. Can you check whether the AfterScroll events occur for master/detail/subdetail ? Michael.

That's a bug I had encountered a very long time ago.

Stephano

Reply by email

Koenraad Lelong
to Unknown author: There is no principle difference between the master/detail and the detail/subdetail…
Show quoted text 39 lines
On Tue, 4 Jan 2011, Koenraad Lelong wrote: > Hi, > > I have a database (firebird) with master-data, detail-data and > sub-detail-data. > In lazarus 0.9.28.2, svn 22279, I defined a TIBConnection, a > TSQLTransaction and three TSQLQuery's. The detail has as its datasource > a datasource coupled with the master. The subdetail has as its > datasource a datasource coupled with the detail. > To show the data I have three TDBGrids, their datasources are those > three datasources coupled with the three queries. > > When I start the application, the master that shows has several details, > each having several sub-details. When I scroll the details, the > subdetails follow the detail. That's good. But when I scroll the master, > only the details follow, the subdetail-grid goes blank. > > To try finding what happens I added a button that opens the > sub-detail-query. If I click on it I get the expected subdetails. When I > scroll the master again, the subdetail disappears again. Again I can get > it back by clicking my debug-button. > > To debug this further, I added events for beforescroll, afterscroll, > beforeclose and beforeopen for all three queries which write to a > logfile. It seems that the beforeclose event is not fired for the > subdetail-query, although it is closed somehow. > > I hope this makes sense to someone. Is there anything I'm missing ? Or > have I found a bug ? There is no principle difference between the master/detail and the detail/subdetail relation, so I'd expect your setup to work. Can you check whether the AfterScroll events occur for master/detail/subdetail ?

Hi,
Sorry that it took some time to respond.
Some explanation of the logfile :
In the application I added some code to include text in the logfile explaining what's hapening.
In the events (beforeOpen, BeforeClose, AfterScroll) I checked which tables are open : P for table Printen, S for table Staffels and W for table DefWerktijden. When you see the letter the table is open, if not the table is closed.
I added two buttons to my application to insert some text in the logfile. First one to indicate the start of a scroll action in the detailgrid : "Before scrolling detail". Second one to indicate the start of a scroll in the mastergrid :"Before scrolling master". A third button is used to open the subdetail-table manually, text : opening sub-detail table.

This is the logfile :

Opening Tables
BeforeOpen qryPrinten:___
AfterScroll qryPrinten:P__
BeforeOpen qryStaffels:P__
AfterScroll qryStaffels:PS_
BeforeOpen qryDefWerktijden:PS_
AfterScroll qryDefWerktijden:PSW
Tables open
Before scrolling detail
BeforeScroll qryStaffels:PSW
BeforeOpen qryDefWerktijden:PS_
AfterScroll qryDefWerktijden:PSW
AfterScroll qryStaffels:PSW
before scrolling master
BeforeScroll qryPrinten:PSW
BeforeClose qryStaffels:PSW
BeforeOpen qryStaffels:P__
AfterScroll qryStaffels:PS_
AfterScroll qryPrinten:PS_
opening sub-detail table
BeforeOpen qryDefWerktijden:PS_
AfterScroll qryDefWerktijden:PSW

If there is anything more I can do please ask for it. Is there some "public" firebird-database I can use to make a sample application ?

Kind regards,

Koenraad Lelong.

Reply by email

Koenraad Lelong
to Koenraad Lelong
In the events (beforeOpen, BeforeClose, AfterScroll) I checked which tables are open : P for table Printen, S for table Staffels and W for table DefWerktijden. When you see the letter the table is open, if not the table is closed.

Hi,
Forgot to say that Printen is the master-, Staffels the detail- and DefWerktijden the subdetail-table.

Bye,

Koenraad Lelong.

Reply by email

Koenraad Lelong
to Koenraad Lelong: Sorry that it took some time to respond. Some explanation of the logfile : In the…
Koenraad Lelong wrote
Op 04-01-11 16:18, schreef:

Hi,

Since there is no response, I created a sample application, using the Firebird employee demo database.
Where can I post the sources ? Approx. 290K zip-file is too big for the list, isn't it?
This could also serve as a demo-program, when it eventually works.

Sidenotes :
- There is a calculated field (aged) in table sales. When I tried to import the fields, I could not import that field because the datatype is unknown. Now I don't "select" that field and that's OK.

- Does the login-prompt work ? Normally I don't have logins, I hardcode the username and a password. Now I could not, for obvious reasons. So I enabled the login-prompt, but this seems not to work when I open the database. Or should I do it otherwise ?

Regards,

Koenraad Lelong.

Reply by email

Joost van der Sluis
to Koenraad Lelong
Koenraad Lelong wrote 9 lines
Op 07-01-11 08:29, Koenraad Lelong schreef: > Op 04-01-11 16:18, schreef: Hi, Since there is no response, I created a sample application, using the Firebird employee demo database. Where can I post the sources ? Approx. 290K zip-file is too big for the list, isn't it? This could also serve as a demo-program, when it eventually works.

Bug-report?

Joost.

Reply by email

Koenraad Lelong
to Joost van der Sluis
Joost van der Sluis wrote 15 lines
On Thu, 2011-01-13 at 14:14 +0100, Koenraad Lelong wrote: > Op 07-01-11 08:29, Koenraad Lelong schreef: >> Op 04-01-11 16:18, schreef: > Hi, > > Since there is no response, I created a sample application, using the > Firebird employee demo database. > Where can I post the sources ? Approx. 290K zip-file is too big for the > list, isn't it? > This could also serve as a demo-program, when it eventually works. Bug-report? Joost.

Hi Joost,

Since I was not sure I didn't make errors myself, I tried to get information via the list. Now I submitted a bugreport and the demo-sources : http://mantis.freepascal.org/view.php?id=18491

I hope this will be solved soon, since I can't go much further with my project without the functionallity.

TIA,

Koenraad Lelong.

Reply by email