Subject Master-Detail grids not linking
Author Phil Henningsen
Subj: Master-Detail grids not linking

I think (newbie, that I am) that the problem is related to the "union" in
the Detail query...

IB_Grid_Mas (the Master) is ok.
It's IB_Query_Mas.SQL.Text is: (the DB has several Million records
spanning 2 months)

select O.Order_Number, O.FirstName||" "||O.LastName AS Customer_Name,
O.Email, O.Record_Timestamp, O.Online_Status,
O.Pending_Count AS Pend, O.Amount,
O.Session_Aff, O.Credited_Aff,
O.Parameters as OrdParams
from S_ORDERS O
where (O.RECORD_TIMESTAMP >= "08/12/2001")
and (O.RECORD_TIMESTAMP < "08/13/2001")
plan (O INDEX (S_ORDERS_BY_TIMESTAMP))

(Actually, the "where" clause is generated at run-time from several user
inputs.)

IB_Query_Mas.KeyLinks = S_ORDERS.ORDER_NUMBER


IB_Grid_Det (the Detail) is NOT OK (ie empty).
I think that the problem is related to the "union"

It's IB_Query_Det.SQL.Text is:

select Order_Number, 'B' as Type, Bundle_Number,
cast('' as VarChar(3)) as Item,
Record_Timestamp, Pending_Count as Pend,
cast(Product_Id as integer) as Product,
"" as Description, Parameters
from S_BUNDLES where Order_Number = :Order_Number
union all
select Order_Number, 'I' as Type, Bundle_Number,
cast(Item_Number as VarChar(3)) as Item,
Record_Timestamp, Pending as Pend,
Product_Id as Product,
"" as Description, Parameters
from S_ITEMS where Order_Number = :Order_Number

Currently, IB_Query_Det.KeyLinks =
ORDER_NUMBER
BUNDLE_NUMBER
ITEM
but other variations made no difference.
Should it contain TYPE? (a "virtual field")

IB_Query_Det.MasterLinks is empty, although I have tried:
S_BUNDLES.ORDER_NUMBER=S_ORDERS.ORDER_NUMBER
S_ITEMS.ORDER_NUMBER=S_ORDERS.ORDER_NUMBER

Currently, IB_Query_Det.MasterParamLinks =
ORDER_NUMBER=S_ORDERS.ORDER_NUMBER

The detail grid is empty.

(ps: the queries do work. they are unchanged from the previous
version that worked fine, but slowly... using IB Express and
InfoPower.)

Thanks for your help.

Phil Henningsen
------------------------------
Developer / Programmer
Astrology.com, an iVillage company
PhilH@...
(415) 447-6193 ext 819
Sign: Capricorn