Subject Re: Params not updating in Select + Union
Author Marco Menardi
I had a similar problem, with a working M/D relatinoship that broke
after updating IBO, but since it's not very often used, I discovered
it just recently.
I fixed it removing the table reference in the relation, i.e.
MasterLinks: ORDERITEMS.INVOICENUM=INVOICENUM
will become
MasterLinks: INVOICENUM=INVOICENUM

Try if this is ok for you also
best regards
Marco Menardi

--- In IBObjects@yahoogroups.com, "Rick Roen" <rick@l...> wrote:
>
> D7 + IBO 4.5B
>
> I have a master table for orders that several other queries get
> their INVOICENUM param from. The detail queries are both in the same
> data module and in others. Basically they all work as expected
> except one query that has a union. This particular IB_Query
> component does not update its params when the master table changes.
> I can update the :INVOICENUM param in code and everything is ok.
>
> Since the union is the only thing I can think of that is different,
> I am wondering if this could be a problem?
>
> Here is an outline of the SQL and the actual SQL is below in case I
> have missed something:
>
> pseudo SQL:
>
> Select Field1, Field2, ... from
> Table1 T1
> join Table2 on ...
> join Table3 on ...
> Where T1.INVOICENUM = :INVOICENUM
> Union
> Select Field1, Field2, ... from
> Table1 T1
> join Table2 on ...
> join Table3 on ...
> Where T1.INVOICENUM = :INVOICENUM
> Order by 2, 1
>
> I have the following settings for the TIB_QUERY:
> MasterSource: DMOrders.QOrders
> MasterLinks: ORDERITEMS.INVOICENUM=INVOICENUM
> AutoFetchAll: True
> RefreshOnParamChange: True
> KeyRelation: ORDERITEMS
>
> There are no Orderings set and no EditSQL, InsertSQL nor DeleteSQL.
>
>
> Any ideas why this particular param does not get updated?
>
> Rick
>
> Real SQL:
>
> Select
> CAST(' ' || PT.Description as Char(31)) as DESCRIPTION
> , PT.WIDTH
> , PT.HEIGHT
> , Count( QTY_ORDER ) as POCKET_COUNT
> , CAST(null as INTEGER) as TOTAL_ROWS
> , CAST(NULL AS INTEGER) AS EXTRA_POCKETS
> from ORDERITEMS OI
> join PACKET P on P.ITEMNUM = OI.ITEMNUM and not P.ISHARDWARE = 1
> Join PACKET_TYPE PT on PT.IDNUM = P.PKT_GROUP
> where OI.INVOICENUM = :INVOICENUM
> Group by PT.Description, PT.WIDTH, PT.HEIGHT
> Having Count( QTY_ORDER ) <> 0
> UNION
> Select
> CAST('PACKET WIDTH ' || PT.WIDTH || 'mm' as Char(31) )
> , PT.WIDTH
> , PT.HEIGHT
> , COUNT( QTY_ORDER ) AS POCKET_COUNT
> , CAST(NULL as INTEGER) AS TOTAL_ROWS
> , CAST(NULL AS INTEGER) AS EXTRA_POCKETS
> from ORDERITEMS OI
> join PACKET P ON P.ITEMNUM = OI.ITEMNUM and not P.ISHARDWARE = 1
> JOIN PACKET_TYPE PT ON PT.IDNUM = P.PKT_GROUP
> WHERE OI.INVOICENUM = :INVOICENUM
> GROUP BY PT.WIDTH, PT.HEIGHT
> HAVING COUNT(QTY_ORDER) <> 0
> ORDER BY 2, 1
>