I want a logic in my query where when prompt 2 (:2) is provided a value or is not blank, the STRM field will automatically be equal to the FIRST_TERM_VALID
field, otherwise if :2
is black then the STRM
field equals any.
This is the part of the code:
AND A.STRM LIKE (
CASE
WHEN :2 <> ' '
THEN G.FIRST_TERM_VALID
ELSE '%'
END
)
The problem is with this part of my query, I can no longer pull any results.
Create an expression on PS Query and use it like a criteria
AND A.STRM = CASE WHEN :2 IS NULL THEN A.STRM ELSE G.FIRST_TERM_VALID END
If prompt :2 is empty it's more likely to be null. This could be what you're searching for:
If you want to test for blank too, try this:
Feel free to add expressions. The pattern should be visible.
Your logic can be a lot simpler:
Either
:2
is null or check ifA.STRM = G.FIRST_TERM_VALID