0

How to use operator like in BIRT computed column?

I tried:

if (row["Dept"] == "%desc%") { 'Test1' } else { 'Test2' } 

but it doesn't work.

And

if (row["Dept"] like "%desc%") { 'Test1' } else { 'Test2' } 

I have an error message - [Row:1, Column:28] missing ) after condition


For example in Crystal Reports I use

if {Dept} like ["*desc*", "*desc1*"] then 'Test1' else 'Test2' 

But BIRT not support operator 'then'

Thanks in advance

1 Answer 1

2

LIKE is SQL syntax, whereas the expression syntax for a computed column is Javascript. But why are you using a computed column at all, when you can achieve the same result with pure SQL? E.g. with Oracle, the following SQL expression is equivalent:

case when DEPT like '%desc%' then 'Test1' else 'Test2' end 

OTOH if you insist on using a computed column, you could use regular expressions. See JavaScript operator similar to SQL "like"

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.