I need to define a clause for my dynamic SOQL query, based on the value in my
userRegion variable, by adapting the query from this answer.
When I try to use
String queueOwnerRegionClause = ( userRegion == 'Asia' ? ' Asia__c = TRUE ' : ( userRegion == 'EU' ? ' EU__c = TRUE ' : ( userRegion == 'NA' ? ' NA__c = TRUE ' )));
I get these errors
Incompatible types in ternary operator: Boolean, String
(error location: 2nd line)
unexpected syntax: 'mismatched input ')' expecting COLON'
adding a colon at the end of the 3rd line causes this error instead
unexpected token: ')'
There's obviously a simple fix for these errors but I've tried searching for examples of other SOQL that create clauses by using this method & can't find any. I'm not sure which other search terms to use.
What's the correct syntax to use to set the criteria for this clause?