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

New to Qlikview - Expression with nested if's that can have multiple outcomes

Hello,

I'm rather new to Qlikview and need help with an nested if within an expression. I'm pulling in a customer report and need to perform a check to make sure the columns are in sync. For example column A list the Customer Address from Application A, while column B lists the Customer Address from Application B. Column C would list Customer City from Application A while column D would list Customer City from Application B. This column check goes on about 6 levels deep (Customer address 1, customer address 2, City, State, Zip, Country).

I have no problem with a straight if statement that shows if 1 column is out of sync, but my problem is I need to show all out of sync items. A simple if statement would drop out after the first out of sync issue is found, while I need it to show all out of sync situations.

if ([A_STREET1_2] <> [B_STREET1_2], 'Business Review- Street Address 1 is Out of Sync',
if ([A_STREET2_2] <> [B_STREET2_2], 'Business Review - Street Address 2 is Out of Sync',
if ([A_STREET3_2] <> [B_STREET3_2], 'Business Review - Street Address 3 is Out of Sync',
if ([A_CITY_2] <> [B_CITY_2], 'Business Review - City is Out of Sync',
if ([A_COUNTRY_2] <> [B_COUNTRY_2], 'Business Review - Country is Out of Sync',
if ([A_REGION_2] <> [B_REGION_2], 'Business Review - Region is Out of Sync'))))))

Can someone help out a newbie please 🙂

3 Replies
Anonymous
Not applicable
Author

I would make each test a variable and then concatenate the values.

You can use some string manipulation functions (eg. replace, trim etc) to remove any unwanted separators.

var1: if ([A_STREET1_2] <> [B_STREET1_2], 'Business Review- Street Address 1 is Out of Sync')

var2: if ([A_STREET2_2] <> [B_STREET2_2], 'Business Review - Street Address 2 is Out of Sync')

var3: if ([A_STREET3_2] <> [B_STREET3_2], 'Business Review - Street Address 3 is Out of Sync')

var4: if ([A_CITY_2] <> [B_CITY_2], 'Business Review - City is Out of Sync')

var5: if ([A_COUNTRY_2] <> [B_COUNTRY_2], 'Business Review - Country is Out of Sync')

var6: if ([A_REGION_2] <> [B_REGION_2], 'Business Review - Region is Out of Sync')

=$(var1) & '|' & $(var2) & '|' & $(var3) & '|' & $(var4) & '|' & $(var5) & '|' & $(var6)

Anonymous
Not applicable
Author

Martin,

Thanks so much for the reply. The coding you gave me appears to work at

script level, but I need it to work at UI level. Do I need to have another

row for a total of 7 to make it work at UI level? Thanks again for your help

Thanks,

Chris

On Fri, Oct 5, 2018 at 12:13 PM Martin Papier <qcwebmaster@qlikview.com>

Anonymous
Not applicable
Author

 

Hi Chris

 

I’m afraid that I’m not a Qlikview user (I use Qlik Sense) so can’t really advise any further on how this solution could be implemented.

 

Sorry about that.

 

Kind regards

 

Martin