Subject Re: [IBO] MasterParamLinks?
Author Rick Roen
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 06:05 PM 26/05/2005 +0000, you wrote:
> >Hi All,
> >
> >Delphi 7.0, FB 1.5
> >
> >I have two IBO_Queries.
>
> Do you mean IBOQueries or IB_Queries? <--- ANSWER THIS

Sorry, typo. I am using IB_Query

>
> >One gets the items sold to a customer for a
> >date range and the other gets the total of these sales amounts for
> >the same range.
> >
> >I get the user input for the customer number, begin and end dates
> >with and IB_Edit and two IB_DateTimePickers with their ParamName
set.
> >
> >The SQL is like this
> >
> >ITEMS LIST TABLE
> >Select.... from Table where Custnum = :Custnum and Date_Invoice
> >between :Begin and :End
> >
> >ITEMS TOTAL TABLE
> >Select Sum(TOTAL) from Table where Custnum = :Custnum and
> >Date_Invoice between :Begin and :End
> >
> >I have the edit and datetimepickers feeding one table with no
> >problem, but I would like it to supply the parameters to BOTH
tables.
> >
> >I thought I could do this with the MasterParamLinks in the TOTAL
> >table, but it will only relate a field in the LIST table to a
param
> >in the TOTAL table.
> >
> >Is there some way to feed these same params into two tables at
once?
>
> You seem to have the master-detail relationship upside-down.
Surely, one
> total (aggregated) record refers to many details, right?
>
> Also, don't use keywords as parameter names!!

Actually I don't. This was only psudo code; I use :BeginDate
and :EndDate.

>
> Nil out the Mastersource and MasterParamLinks in the TOTAL set and
apply
> them to the LIST set instead.
>
> In the LIST set, Mastersource should be the datasource that points
to the
> TOTAL set. MasterParamLinks should be
> LISTset.Custnum=TOTALset.Custnum
> LISTset.BeginDate=TOTALset.BeginDate
> LISTsetEndDate=TOTALset.EndDate
>
> The data-aware DateTimePickers should be linked only to dates in
the TOTAL
> set. If you want datetimepickers that work with anything, don't
use bound
> ones.
>
>
> The user input controls should be bound to the TOTAL set, not the
detail
> set. Tip: leave the Datafield nil and use ParamName instead.
>
> All this assumes you ARE using ib_queries, not iboqueries. The
ib_
> controls don't work with iboqueries.
>
> Helen

Hello Helen,

You are correct, I had the master/detail reversed - mental block I
guess. It makes more sence with TOTAL feeding the LIST params and is
much easier to setup with the MasterParamLinks.

Thanks