3 Replies Latest reply: Jan 12, 2012 10:21 AM by Jonas Ahne

# If statement not returning expected result.

Hi,

I have an expression where if condition/statement not returning expected result. Let me explain in the brief :

Ex: If some field has two value in character of two. one is 'LA' and 'MA' and we are applying the logic in if condition if ( cityname='LA' the count the distinct cityname)

i;e

(if(City='FT' and name<>'Cancelled' or name<>'Failed' and D_I<>'D'and COMP<>'19',count({\$<TYPE={'xyz'}> }DISTINCT state )+if (city='FT' and name<>'Cancelled' or name<>'Failed',Count({\$<TYPE={'xyz'},COMP={'19'}> }Distinct TICKET)))

here even if we change the City='FT' into 'RT' then also it doesn't changes the value.

thanks

shubham

• ###### If statement not returning expected result.

Shubham,

it would be helpful if you could post some lines of sample data together with your expected output, because I haven't understood your requirement completely, so I can't tell if your statement is right or wrong. I only noticed that under ceratin conditions, it looks like you add the count of distinct states to the count of distinct tickets, is this what you want?

Regards,

Stefan

• ###### If statement not returning expected result.

in place of  use

left(City,2)='FT'

use for all city  as same

hope this helps

• ###### If statement not returning expected result.

As swuehl already said, its hard to understand how you want your expression to function. However maybe the problem is your condition? Since logical AND is evaluated before logical OR the condition that city='FT'/'RT' is not vaild for thw whole condition.

For example, your first condition is true if any of the following is true: (city='FT' and name='Cancelled') or (name <> 'Failed' and D_I<>'D' and comp<>'19').

Thats my only guess using the information you provided.

Regards