🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to compare two set of attribute values?

User: "Anusha"
New Altair Community Member
Updated by Jocelyn
Hi All!

I have a dataset that has 7 columns. one column is like "no" and the other 6 columns are sets of two.
set-1: three columns are "attr1_1",attr1_2","attr1_3" .
set-2: other three columns are "attr2_1",attr2_2","attr2_3".
so I just want to compare these two sets of columns, if we any one column in the first set matching with second set I need to highlight a flag value as "1".

sample Input & Output:

Input:
no          attr1_1                   attr1_2               attr1_3                 attr2_1                      attr2_2                   attr2_3
234      "klo","12","78"         "jkl","13","78"      "jkl","14","89"         "klo","12","78"          "hj","31","4"          "kl","9","0"
456          "klo","12","78"       "klo","12","78"     "ko","12","78"       "jkl","13","78"           "jkl","13","78"         "hj","31","4" 


output:
no          attr1_1                   attr1_2               attr1_3                 attr2_1                      attr2_2                   attr2_3        flag
234      "klo","12","78"         "jkl","13","78"      "jkl","14","89"         "klo","12","78"          "hj","31","4"          "kl","9","0"      1
456          "klo","12","78"       "klo","12","78"     "ko","12","78"       "jkl","13","78"           "jkl","13","78"         "hj","31","4"   0



In the first row--"234", att1_1("klo","12","78") is macthed with attr2_1("klo","12","78") -------------output flag value becomes "1"
and second row--"456", none of (attr1)set-1 columns macthed with set-2 columns(attr2)-----------flag is "0"


Could anyone help me in solving this?

Thanks in Advance!

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Edin_Klapic"
    New Altair Community Member
    Accepted Answer
    I did not execute the process but could directly see a problem with your expression.
    if(%{loop_attribute}==%{loop_attribute1},1,0) 
    needs to be
    if(#{loop_attribute}==#{loop_attribute1},1,Flag)
    Explanation:
    - A macro with % is just the String value. A macro with # means that this is supposed to be an Attribute name.
    - If you do 1,0 previous Flag 1 replacements can be overwritten. That is why you need 1,Flag
    Happy Mining,
    Edin