Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

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

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

6 Replies
MVP
MVP

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?

Not applicable

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

MVP
MVP

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

Not applicable

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.

MVP
MVP

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

Not applicable

Re: If statement issue

That worked! Thank you!!!