I've got one query field (cb_parishmasterorg) that allows a user to select a 'master' record from TABLEA using this query:
Code:
SELECT CONCAT(`org_name`, ' (',
`org_city`, ',', `org_state`,')') AS listing,
`org_id`, `org_country`, `org_name`
FROM `cbdata_cmd_organization`
WHERE `master_org_id`=0 ORDER BY `org_country`,`org_name`
OPTIONS | Label Column = org_id
(master records have a 'master_org_id' of 0)
I then have a 'slave' query field (cb_parishname) that should allow the user to select one of several sub entries that have their 'master_org_id' record set to match the item chosen from the first query field using this query:
Code:
SELECT
CONCAT(`org_name`,' (',`org_city`, ',', `org_state`,' ',
`org_country`,')') AS display, `org_id`, `org_name`
FROM `cbdata_cmd_organization`
WHERE `master_org_id`='[cb_parishmasterorg]' ORDER BY `org_name`
(the second/slave field is set to hide until a selection is made on the first).
The first one is working but the second one is displaying ALL of the entries from the table - like the WHERE clause isn't being run.
I've tried every variation of the WHERE syntax that I can think of, but it either returns no options or all options.
I'm starting to wonder if the problem is that the actual value of cb_parishmasterorg field isn't set yet (until the record is saved).
Is there another way to use the cb query fields and allow the selection of one field to 'influence' the results in a following field?