Subject Re: [IBO] Master Detail Structure with IBOQery
Author Fernando Deola
Hi Helen,

Taking a 'ride' from this question, I'd like to ask you about two other
related things:

1) If I link the detail to the master query by its datasource property WITH
the where clause using a parameter, will It cause any scrolling problems?
(by far, everything seems ok).

2) If I have a detail query, and change the master query at run-time by
setting the datasource property constantly (as the user changes a tabsheet
of a page control, for example). Do I need to close/open the detail query to
reflect the changes or there is a method to do so? Suggestions
appreciated...

P.S.: Using D5/IBO 4.2 Hc TDataSet comps/WinXP Pro.

Regards.

Fernando Deola
EFEX Systems Ltda.
Blumenau - SC - Brazil

----- Original Message -----
From: "Helen Borrie (TeamIBO)" <helebor@...>
To: <IBObjects@yahoogroups.com>
Sent: Tuesday, May 28, 2002 10:44 PM
Subject: Re: [IBO] Master Detail Structure with IBOQery


> At 01:37 PM 28-05-02 -0300, you wrote:
>
> >Hi List!!
> >
> >Win98/Delphi6/IBO4Hc/FIB <--- Firebird?
> >
> >I´m trying to do a master detail structure with TIBOQuery for a QuickRep
> >report exactly the same way I was doing with TQueries (declaring a
> >paremeter on the child Query and setting the datasource propertie of the
> >child query to the datasouce of the master query), but it´s not working
> >fine, it´s seems like the child Query is not scrolling correctly with the
> >master Query, and if I call the First method of the child table it goes
> >really to first record and not the first record of the filtered ones by
> >the master Query.
>
> TDataset has two ways to form master-detail relationships between two
queries:
>
> 1. Link the detail to the master through the Datasource property of the
> detail query (link the detail's Datasource property to the TDatasource
> object that points to the master query). This method is possible only if
> there is a perfect match of fieldname(s) and types between the detail set
> and the KeyLinks of the master set. In this case, don't use parameters -
> TDataset does that itself. Here's the SQL for the detail query in this
case:
>
> select field1, field2, field 3, ....
> from DetTable
>
> --- or ---
>
> 2. If 1) isn't possible, then form the detail set by passing the
> master-linking parameter in the AfterScroll event of the master query and
> ---don't--- set a Datasource property on the detail set:
>
> Here's the detail query:
>
> select field1, field2, field 3, ....
> from DetTable
> where field1 = :field1
>
> In the master set's AfterScroll event pick up the master's KeyLinks and
> apply them to the detail set:
>
> DetailSet.ParamByName('field1').AsInteger :=
> MasterSet.FieldByName('PKField').AsInteger ;
>
> You should never need to call First() on the detail set. If you need to
> test for existence of a detail set, use the IsEmpty property. But perhaps
> I should leave you to explain why you need to call First(). :-)
>
> >There´s any other configurations to this functionality to work fine with
TIBO?
>
> I like to create my datasets for QuickReport using TIB_Query objects, then
> pass my data specs through to TIBOQuery objects using
> AssignSQLWithSearch(). That's because I prefer to work with native
> IBO. If you are working entirely with TIBO* components, there's probably
> not much value in this approach for you.
>
> regards,
> Helen Borrie (TeamIBO Support)
>
> ** Please don't email your support questions privately **
> Ask on the list and everyone benefits
> Don't forget the IB Objects online FAQ - link from any page at
> www.ibobjects.com
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>