Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Getting an odd result working with an If statement combined with Match.
Basically trying to determine if a variable includes a specific string, then perform a calulation depending on whether the specific string is there or not.
If(wildmatch(vVariable,'abc'), sum(field1)+((sum(field2)-sum(field3)),sum(field4)+((sum(field5)-sum(field6))
what I'm experiencing is it will not perform the calculation when the variable does not contain 'abc'. I know the calculations work as I have done them separately. I've noticed this works fine if I remove the addition (the bold part). Can I not do addition with If statement?
I figured it out. It actually had to do with a string function issue (that I did not include in my post as I didnt think that was the issue). Thanks
When you remove bold part you mention it is working, So that mean your condition may like below
If(wildmatch(vVariable,'abc'), sum(field1),sum(field4))
So, Then What if you use something like below
If(wildmatch(vVariable,'abc'), sum(field2)-sum(field3),sum(field5)-sum(field6))
Finally, You have extra parenthesis in your expression where i assume, I would ask you to try this, May be
If(wildmatch(vVariable,'abc'), sum(field1)+((sum(field2)-sum(field3)),sum(field4)+((sum(field5)-sum(field6))
Instead of above one please use this - I removed and added one more red colour parenthesis("(" and ")") only
If(wildmatch(vVariable,'abc'), sum(field1)+(sum(field2)-sum(field3)),sum(field4)+(sum(field5)-sum(field6)))
I figured it out. It actually had to do with a string function issue (that I did not include in my post as I didnt think that was the issue). Thanks