Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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!!!

1 Solution

Accepted Solutions
sunny_talwar

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

View solution in original post

6 Replies
sunny_talwar

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?

Not applicable
Author

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

sunny_talwar

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

Not applicable
Author

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.

sunny_talwar

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

Not applicable
Author

That worked! Thank you!!!