Hello.
Trying to do a automatic lookup on my field “company” in a search application that looks up work order records.
I have two scenarios.
1st…If your logged in as the admin company “TCM” you should show see ALL companies in drop down list.
2nd…If your NOT part of admin company then it should only show you your own company name.
I have…
SELECT
company, company, companyID, active
FROM
tb_companies
WHERE
active = 1 AND company <> “TCM”
OR
(active = 0 AND ‘{company}’ = companyID)
ORDER BY
company ASC
This brings back all companies that are active status and not equal to the admin company “TCM”.
How can i do a SELECT statement that will show all companies if i’m logged in as “TCM” and if not show only the logged in company.
I have a global variable [usr_company] that tells me what company it is but I’m sure how to format the SELECT statement to check for this?
Thanks for any help.