I’m able to filter a table based on a query, and to use the value of a select widget in that query. What I’m having trouble doing is having a conditional in the query to use that select value if it exists, but to do something else if it doesn’t.
IF ({{TestNameFilter.selectedOptionValue}} != 'undefined')
SELECT TestName, etc. FROM table...
WHERE SetId = '{{GetActiveSuite.data[0].Id}}' AND code = '{{SourceCodeInput.text}}' AND TestName = '{{TestNameFilter.selectedOptionValue}}';
ELSE
SELECT TestName, etc. FROM table...
WHERE SetId = '{{GetActiveSuite.data[0].Id}}' AND code = '{{SourceCPIDInput.text}}';
This works fine for detecting if the select is empty, but crashes if it is selected. In that case, IF ('{{TestNameFilter.selectedOptionValue}}' != 'undefined') (note that added single quotes) works, but it doesn’t work if the select is empty.
Thanks for the reply - just getting back to this project now. Neither ({{TestNameFilter.selectedOptionValue}}) nor ('{{TestNameFilter.selectedOptionValue}}') are working when the referenced dropdown has no selection. I get an error in the AS console: An expression of non-boolean type specified in a context where a condition is expected, near 'SELECT'. If I replace that term with (1 = 2), the query runs fine.
It seems like maybe something has changed. The bare quantity still doesn’t work, but ('{{TestNameFilter.selectedOptionValue}}' != 'null') works for both cases, and seems to be the answer. Originally, I never got null as a value, only undefined.
I am seeing this variable working fine, I tried reproducing the error but could not, check out the screenshots below. Anyways if it works for you already, its great.