Start a new topic

Can you use a CASE statement in a Stepper Reference Selection Picker Filter?

hi there, 


I am using a reference selection picker filter in my stepper.


The following two statements work fine on their own:

1) Referenced.Country.ID = 'AU' 

2) Referenced.PL_REGION.PL_Region IS NOT NULL


Ideally id like to do something like the following within my picker filter reference selection:


CASE

          WHEN Record.DistGrp_CVC.FID_Country = 'AU'

                     THEN (Referenced.Country.ID = 'AU' AND Referenced.FID_PL_REGION IS                           NOT NULL)

          ELSE Referenced.PL_REGION.PL_Region IS NOT NULL

END


The ELSE statement works by itself, and the two statements in the THEN statement work individually.


Is it possible to use a case statement in a picker filter?  If so, any suggestions on my SEMQL?  Thank you


1 Comment

Hello

A case when statement can't be interpreted as a boolean, as it can return anything.
The easiest way to make sure your case when statement is interpreted as a boolean is to add an '=1' at the end of it, something like : case [...] end =1


Also as your case when looks simple, it may be converted to a combination of AND and OR instead, that would guarantee it will be interpreted as a boolean, something like:

(Record.DistGrp_CVC.FID_Country = 'AU' AND Referenced.Country.ID = 'AU' AND Referenced.FID_PL_REGION IS NOT NULL)
OR
(Record.DistGrp_CVC.FID_Country <> 'AU' AND Referenced.PL_REGION.PL_Region IS NOT NULL)

 

Login to post a comment