Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
BryanFontes
Contributor III
Contributor III

Suggestion for more Efficient/Elegant way to use IF(,OR OR OR...)

Hey guys,

I currently have this LOAD statment:

 

LOAD 

ID,

AGE,

ESP,

...

FROM [] WHERE AGE>0 and AGE<120 and IF(ESP=('1') or ESP=('2') or ESP=('3') or ESP=('4') or ESP=('5') or ESP=('6') or ESP=('7') or ESP=('8') or ESP=('19') or ESP=('20') or ESP=('21') or ESP=('22') or ESP=('23') or ... ,'ok')='ok';

Is there any way to substitute this bunch of OR for something more elegant or less process-consuming?

Labels (1)
2 Solutions

Accepted Solutions
Thiago_Justen_

Hi there,

There is a cool material here: If Tips by Rob Wunderlich 

Regards

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago

View solution in original post

Vegar
MVP
MVP

You could replace your IF(ESP=('1').... expression with a Match() statement like this

WHERE AGE>0 and AGE<120 AND Match(ESP,1,2,3,4,5,6,7,8,19,20,21,22,23)

View solution in original post

4 Replies
Thiago_Justen_

Hi there,

There is a cool material here: If Tips by Rob Wunderlich 

Regards

Thiago Justen Teixeira Gonçalves
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
Vegar
MVP
MVP

You could replace your IF(ESP=('1').... expression with a Match() statement like this

WHERE AGE>0 and AGE<120 AND Match(ESP,1,2,3,4,5,6,7,8,19,20,21,22,23)

BryanFontes
Contributor III
Contributor III
Author

Thanks!

BryanFontes
Contributor III
Contributor III
Author

Thanks! I used exactly this