6 Replies Latest reply: Oct 21, 2016 4:14 PM by Nicole Scotti

# If statement issue

Hi All,

I am having an issue with an if statement that should be fairly simple. I am really confused why it is not working.

I have 2 separate statements that I need to check when they are the same. These are the 2 working statements.

If(SubField(Matter_Interval_BA_OA_Key,'|',4) = SubField(Matter_Interval_BA_OA_Key,'|',5), 1, 0) AS BA_OA_Flag

If(SubField(Matter_Interval_BA_OA_Key,'|',4) = Working_TK, 1, 0) AS BA_WA_Flag

When I combined them to see where SubField(Matter_Interval_BA_OA_Key,'|',4) is equal to SubField(Matter_Interval_BA_OA_Key,'|',5) and it is also equal to Working_TK it doesn't work.

Does anyone know what this is not working??

Thank you!!!

• ###### Re: If statement issue

You provided the ones which worked, but did not provide the one which did not work . Can you provide the one which did not work?

• ###### Re: If statement issue

Sure. I've tried a variety of things but this is generally what I am trying to get to.

If(SubField(Matter_Interval_BA_OA_Key,'|',4) = SubField(Matter_Interval_BA_OA_Key,'|',5) AND

SubField(Matter_Interval_BA_OA_Key,'|',4) = Working_TK, 1, 0) AS BA_OA_WA_Flag

• ###### Re: If statement issue

It essentially seems like that you are checking for this, isn't it?

If(SubField(Matter_Interval_BA_OA_Key,'|',5) = Working_TK, 1, 0) as BA_OA_WA_Flag

• ###### Re: If statement issue

Not quite. Let's call SubField(Matter_Interval_BA_OA_Key,'|',4)  as BA and SubField(Matter_Interval_BA_OA_Key,'|',5) as OA for my own clarity..

So I need a flag for when BA does not equal OA, and BA does not equal Working_TK. OA and Working_TK can be equal, as long as neither of them are equal to BA.

• ###### Re: If statement issue

So may be this:

If(SubField(Matter_Interval_BA_OA_Key,'|',4) <> SubField(Matter_Interval_BA_OA_Key,'|',5) and

SubField(Matter_Interval_BA_OA_Key,'|',4) <> Working_TK, 1, 0) AS BA_OA_WA_Flag

• ###### Re: If statement issue

That worked! Thank you!!!