Hi all;
Struggling with the issue of how to implement the following on my eGroupware remake:
How can I do conditional lookups for a dropdown which needs to go through a details table that will cross-link any record to any record in the project. The fields are ID, link_app1, link_id1, link_app2 and link_id2. In this case you choose a CUSTOMER and then choose a SITE filtered by that CUSTOMER ID through the links table. Because you can link in either direction, the CUSTOMER or SITE could either be link_id1 or link_id2. In order to sort that out, I used this as the SITE query:
This seems to give the results I need in the plain query,
![Posted Image]()
but when I try to use any of the aliases as a link in the conditional ("This dropdown is dependent on"...) it just returns all records. I thought the aliases may not be available in this scope, but they are listed as selectable fields. I also tried running the same basic query for BOTH the CUSTOMER and the SITE with similar results. I think I have a fundamental error in my logic here somewhere. I'm sure there must be some way to do this, but I'm a little lost. Any help to give me a kick in the right direction will be appreciated. Thanks.
Struggling with the issue of how to implement the following on my eGroupware remake:
How can I do conditional lookups for a dropdown which needs to go through a details table that will cross-link any record to any record in the project. The fields are ID, link_app1, link_id1, link_app2 and link_id2. In this case you choose a CUSTOMER and then choose a SITE filtered by that CUSTOMER ID through the links table. Because you can link in either direction, the CUSTOMER or SITE could either be link_id1 or link_id2. In order to sort that out, I used this as the SITE query:
SELECT a3.cat_id, a3.n_fileas, a3.contact_id, egw_links.link_app1, egw_links.link_app2, egw_links.link_id1, egw_links.link_id2, (CASE WHEN egw_links.link_id1 = a3.contact_id THEN egw_links.link_id1 WHEN egw_links.link_id2 = a3.contact_id THEN egw_links.link_id2 END) AS record_id, (CASE WHEN egw_links.link_id1 = a3.contact_id THEN egw_links.link_id2 WHEN egw_links.link_id2 = a3.contact_id THEN egw_links.link_id1 END) AS matched_link FROM addressbook AS a3 LEFT OUTER JOIN egw_links ON (a3.contact_id = egw_links.link_id1 OR a3.contact_id = egw_links.link_id2) WHERE (a3.cat_id =303) AND (a3.n_fileas !="") AND (egw_links.link_app1 = "addressbook" AND egw_links.link_app2 = "addressbook") AND (a3.contact_id = egw_links.link_id1 OR a3.contact_id = egw_links.link_id2)
This seems to give the results I need in the plain query,
but when I try to use any of the aliases as a link in the conditional ("This dropdown is dependent on"...) it just returns all records. I thought the aliases may not be available in this scope, but they are listed as selectable fields. I also tried running the same basic query for BOTH the CUSTOMER and the SITE with similar results. I think I have a fundamental error in my logic here somewhere. I'm sure there must be some way to do this, but I'm a little lost. Any help to give me a kick in the right direction will be appreciated. Thanks.