Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Logic to compare the values wit different variation

Hi

The Group1 shouldbe equal to Group2, as we need to follow the below logic to define the code. would you pleas help me to correct the code as I'm new to QlikView.

AAA = 'SECA ● SECB ● SECC’

AAA = 'SECB ● SECA ● SECC’

AAA = 'SECC ● SECB ● SECA’

AAA = ‘'SECC ● SECA ● SECB’

Group1

Group2

AAA

'SECA ● SECB ● SECC’

if(Group1)='AAA' and (Group2)='SECA ● SECB ● SECC' or (Group2)='SECA' and (Group2)='SECB' and (Group2)='SECC','Correct','Wrong' as Data,

1 Solution

Accepted Solutions
sunny_talwar

Try this out:

Group:

Load *

Inline

[Group1, Group2,

    AAA, SECA ● SECB ● SECC

    AAA, SECB ● SECA ● SECC

    AAA, SECC ● SECB ● SECA

    AAA, SECC ● SECA ● SECB

    AAA, SECA ● SECB ● SECC ● SECD

    AAA, SECA ● SECB

];

   

Groupnew:

LOAD Group1,

  Group2,

  If(Group1 = 'AAA' and Index(Group2, 'SECA') and Index(Group2, 'SECB') and Index(Group2, 'SECC') and Len(Trim(KeepChar(Group2, '●'))) = 2, 'Correct', 'Wrong') as Data

Resident Group; 

View solution in original post

5 Replies
Clever_Anjos
Employee
Employee

if(

    (Group1='AAA' and Group2='SECA ● SECB ● SECC')

or (Group2='SECA' and Group2='SECBSECC','Correct','Wrong') as Data,

sunny_talwar

Not entirely sure what you are doing, but you have some misplaced parenthesis:

If(Group1 = 'AAA' and Group2 = 'SECA ● SECB ● SECC' or (Group2 = 'SECA' and Group2 = 'SECB' and Group2 = 'SECC'), 'Correct', 'Wrong') as Data,

I am still not 100% sure if this is right, but may be if you can expand on the logic, we might be able to provide a better response

Anonymous
Not applicable
Author

Thanks for your response.

But when I try to update the following logic doesn't match. Please refer logic screenshot + attached qvw which I created.

Logic.JPG

sunny_talwar

Try this out:

Group:

Load *

Inline

[Group1, Group2,

    AAA, SECA ● SECB ● SECC

    AAA, SECB ● SECA ● SECC

    AAA, SECC ● SECB ● SECA

    AAA, SECC ● SECA ● SECB

    AAA, SECA ● SECB ● SECC ● SECD

    AAA, SECA ● SECB

];

   

Groupnew:

LOAD Group1,

  Group2,

  If(Group1 = 'AAA' and Index(Group2, 'SECA') and Index(Group2, 'SECB') and Index(Group2, 'SECC') and Len(Trim(KeepChar(Group2, '●'))) = 2, 'Correct', 'Wrong') as Data

Resident Group; 

Anonymous
Not applicable
Author

Thanks Sunny, it works well