Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Webintelligence help with IN function

Status
Not open for further replies.

asanchez4

Programmer
Apr 22, 2004
32
0
0
US
Could someone please help me. I am building a report and I would like to use the IN function within an IF function.

I would expect it to work like this

=IF([Field 1] IN ("car", "truck");1;0)

But I keep getting syntax errors. I can't find any documentation on using the IN function even though it is listed as one of the available functions.

Thanks in advance.
 
You are confusing the syntax of the general 'IF THEN ELSE' with the IIF function.

BO only works with the traditional 'IF THEN ELSE'

So:

=If (<field1>) IN ("car","truck") THEN ..... ELSE ....

The syntax you are attempting is reserved for the IIF function (which is not available)

T. Blom
Information analyst
tbl@shimano-eu.com
 
No Luck.

I even eliminated the IF portion of the code to reduce it to a boolean expression. This is the exact code

=([Product Hierarchy Name]) In("car","truck")

The exact error message is
Syntax error in formula at position 39. (Error: WIS 10001)

Any suggestions?

 
Sorry,

BO has its own 'IN' operator, try:

=If (<field1>) InList ("car","truck") THEN ..... ELSE ....


T. Blom
Information analyst
tbl@shimano-eu.com
 
Ties, I don't think Inlist is in Webi, just BO FC.
 
ouch,

that may be quite so..

How about a nested structure then?

= If(<field1> = "car") Then "X" Else If(<field1> = "truck") Then "X" Else "Y".

Gets a bit long with a long list of values, but will that work in WebI?

T. Blom
Information analyst
tbl@shimano-eu.com
 
Nope Again, Ties...

I don't think it's If-then-else in webi. It's more like a "decode".

So Asanchez was right with his:

=IF([Field 1] IN ("car", "truck");1;0)

And instead of the IN he (or she for that matter) could use something like =IF([Field 1] = "car" OR [Field 1] ="truck");1;0)

Or Nesting decodes of course...

But both options are not very pleasant with lots of values in your "inlist".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top