Subject Re: [IBO] Parameter looses value on reorder
Author Helen Borrie
At 07:54 PM 08-11-02 +0100, you wrote:
>Hi All,
>
>I have a detail query with an additional parameter(a date) to further limit
>the amount of data returned. The masterlink is set in the property editor at
>MasterLinks, the additional parameter at JoinLinks.

This is wrong. JoinLinks is not for parameters. It is used *only* for the
situation where a joined dataset is using implicit joins. Its purpose is
to tell the parser which of the items in the WHERE clause are join criteria.

Here is an example of an implicit join to illustrate:

select a.field1, b.fieldx, a.field3, b.fieldy from aTable a, bTable b
where a.field0 = b.fielda <--- this is a joinlink
and a.field3 between :date1 and :date2

JoinLinks in this dataset:

ATABLE.FIELD0=BTABLE.FIELDA

It is static (you don't parameterise it, you don't change it).

If your query used the explicit join syntax instead (recommended) then you
would not use JoinLinks at all:

select a.field1, b.fieldx, a.field3, b.fieldy
from aTable a
join bTable b
on a.field0 = b.fielda
where a.field3 between :date1 and :date2


>This parameter is set at
>the start of the application and whenever the user changes the date. Though
>I don't know if this is how it should be done but it works properly so far.
>Only when reordering the grid which gets its data from this query, the value
>for the date is lost. In order to solve the problem I just reset the
>parameter in the OnOrderingChanged event but I wonder if this is the
>expected behaviour or if I have missed something.
>
>Any hints?

Use the explicit join syntax and avoid JoinLinks.
Don't try to parameterise your JOIN criteria, since (if it were possible)
it would invalidate the query specification.
Also ensure that your KeyLinks are capable of uniquely identifying each
individual row in the joined set.

Helen