This topic is locked
[SOLVED]

 WHERE expression in Lookup Wizard

4/15/2020 8:55:32 PM
PHPRunner General questions
K
keithh0427 author

I'm wanting to use some tabs in the Add, Edit and View pages AND use a Lookup Wizard on a tab that has values on the form from other tabs.
I'm using the following expression:

active = 'Y' AND lang_code="':field.lang_code'" AND encounterID="':field.encounterID'"
I've attempted many variations of the above. Some threw errors which I worked through, but none have actually resulted in any success. I have thried the WHERE statement in mySQL and it does provide me with the expected rows.
active = 'Y' AND lang_code="en" AND encounterID="401"

works and both fields
So, I'm wondering if the tabs have anything to do with it.

Sergey Kornilov admin 4/15/2020

You should be using single quotes only in SQL:

active = 'Y' AND lang_code=':field.lang_code' AND encounterID=':field.encounterID'
K
keithh0427 author 4/16/2020

I simplified the expression to just one variable and then placed that field on the same tab as the column with the Lookup Wizard.
active = 'Y' AND encounterID=':field.encounterID'
But, the query comes but:

active = 'Y' AND encounterID=''
The list of values from the Lookup Wizard is blank.
However, If I replace :field.encounterID with 401 (which is the value I'm looking for in this case), I can see the dropdown list of values that I would expect.

Sergey Kornilov admin 4/16/2020

https://xlinesoft.com/phprunner/docs/sql_variables.htm
If you need to refer to the field value simple use :fieldname and not :field.fieldname

active = 'Y' AND encounterID=':encounterID'
K
keithh0427 author 4/16/2020



https://xlinesoft.com/phprunner/docs/sql_variables.htm
If you need to refer to the field value simple use :fieldname and not :field.fieldname

active = 'Y' AND encounterID=':encounterID'



Thank you!