Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
Partner
Partner

If Expression Not Working As Expected

Hello:

I have the following If expression that I'm trying to use as a calculated dimension in a straight table.  What I'm trying to do is if starting in position 4 for the rest of the string if SUBLOB equals 'AAA Shared Tech', then set SUBLOB = BBB, otherwise, starting in position 4 give me the rest of the string.  Here's the If:

=If(mid(SUBLOB, 4) = 'AAA Shared Tech', SUBLOB = 'BBB', mid(SUBLOB, 4))

However, I'm still getting AAA Shared Tech.  Any ideas what I may be doing wrong?  As always, thanks in advance for any and all help and responses.

1 Solution

Accepted Solutions
Partner
Partner

Re: If Expression Not Working As Expected

Hi, what happens when you do this:

=If(mid(SUBLOB, 4) = 'AAA Shared Tech','BBB', mid(SUBLOB, 4))

View solution in original post

5 Replies
Partner
Partner

Re: If Expression Not Working As Expected

Hi, what happens when you do this:

=If(mid(SUBLOB, 4) = 'AAA Shared Tech','BBB', mid(SUBLOB, 4))

View solution in original post

Partner
Partner

Re: If Expression Not Working As Expected

Hello Niclas:

Thanks for the response.  I still get AAA Shared Tech in the straight table.  It doesn't change to BBB.

Re: If Expression Not Working As Expected

May be this

=If(WildMatch(SUBLOB, '???AAA Shared Tech*'), 'BBB', Mid(SUBLOB, 4))

Partner
Partner

Re: If Expression Not Working As Expected

Hello Niclas:

This is a bit embarrassing, but your solution actually does work and I will mark your response as the correct one.  I had another problem with my If expression in that I was using the wrong starting position for the mid function.  Instead of starting at 4, it should have been 5.    My apologies for any inconvenience.  Thank you for your help.

Partner
Partner

Re: If Expression Not Working As Expected

Hello Sunny:

Please see my latest response to Niclas.  Niclas's solution does indeed work.  Your solution also works.  Thank you for your response.  I appreciate it.