If function in mysql query

Hey guys! Can someone help me out?
I have a problem with if function in mysql query (I want to create something like a switch)

SELECT concat(COUNT(*)) FROM {Root Container.NumberOfNumber 1.Table}
if ({Root Container.Tab Strip.selectedTab}==‘Ethernet’ then concat(where ({Root Container.NumberOfNumber 1.Where} LIKE ‘%{Root Container.NumberOfNumber 1.Like}%’))
concat(where ({Root Container.NumberOfNumber 1.Where} LIKE ‘%{Root Container.NumberOfNumber 1.Like}%’)
AND ({Root Container.NumberOfNumber 1.TimeTable} Between ‘{Root Container.NumberOfNumber 1.StartTime}’ AND ‘{Root Container.NumberOfNumber 1.EndTime}’)))

The expression language if() is not available in the SQL Query form. You can only reference tags and property bindings. Try creating a custom property on your component called queryString and use the expression language if() to return your different query strings. Then in your SQL Query you can just reference
{Root Container.NumberOfNumber 1.queryString}

?how we can do it?

maybe we can use case function?

Sure. You can use a case or nested if. Whatever makes sense for you.

Here’s a if example


1 Like

Thank u so much!!! Works perfectly!

Thanks a lot! I understood what you meant 20-30 minutes after your answer. This is brilliant! Thank you again!