Subject Dynamic Query
Author Malcolm Smith
In my form where the user can browse a lookup table I have another grid next
to it that I want to use to display all records from two other tables which
are using the currently selected 'lookup' record.

The table being browsed is called IPLOOKUP and the GROUPS/SPRITEDETAIL are a
master/detail relationship where the SPRITEDETAIL.SD_IPLOOKUP field will
match the IPLOOKUP.ID field. My query is designed to return all records
from the master/detail tables that currently use the IPLOOKUP.ID field.

My TIB_Query statement for the other grid is:

SELECT GROUPS.GRP_DESCRIPTION,
SPRITEDETAIL.SD_DESCRIPTION,
SPRITEDETAIL.SD_CAMERA,
SPRITEDETAIL.SD_IPLOOKUPID,
IPLOOKUP.ID,
IPLOOKUP.IPL_DESCRIPTION,
IPLOOKUP.IPL_IPADDRESS,
IPLOOKUP.IPL_LOCAL
FROM SPRITEDETAIL
INNER JOIN GROUPS ON (SPRITEDETAIL.SD_GROUPID = GROUPS.ID)
INNER JOIN IPLOOKUP ON (SPRITEDETAIL.SD_IPLOOKUPID = IPLOOKUP.ID)
WHERE SD_IPLOOKUPID = :ID


The query has been tested in an external application and it works fine so I
know I have a configuration issue.

* The KeySource for this query points to the datasource connected to
IPLOOKUP

* KeyLinks for this query is set to SD_IPLOOKUPID

* RequestLive is true

I'm using the same transaction component for all TIB_Query components
concerned.

Without the last line in the SQL I get all records (but they are wrong) and
when using this last line I get no records (also wrong).

What have I forgotten or done wrong ?


Malcolm Smith
MJ Freelancing
ABN: 30 671 763 146
http://www.mjfreelancing.com