Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
user-azadi
Contributor III
Contributor III

compare two table in edit script

hi,

i want compare table1 and table2 and show difference rows in those. common filed in tables is Field1 and result must be

1,a1

2,c1

please tell me how we can do...

--------------------------------------------------------------

Table1:

LOAD * INLINE [

    Field1, Name1

    1, a1

    2, b1

    3, c1

    4, d1

    5, e1

];

Table2:

LOAD * INLINE [

    Field1, Name2

    2, b2

    4, d2

    5, e2

];

--------------------------------------------------------------

1 Solution

Accepted Solutions
aarkay29
Specialist
Specialist

May be this


Table2:

LOAD * INLINE [

    Field1, Name2

    2, b2

    4, d2

    5, e2

];

Table1:

LOAD * INLINE [

    Field1, Name1

    1, a1

    2, b1

    3, c1

    4, d1

    5, e1

]

Where not Exists(Field1);

Drop Table

     Table2;

View solution in original post

6 Replies
Anil_Babu_Samineni

2, c1 ?? or 3, c1 ??? Can you confirm once

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
user-azadi
Contributor III
Contributor III
Author

excuse me Anil,i wrote wrong . 3,C1 is correct.

result must be:

1,a1

3,c1

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Is Field1 some sort of primary key? Then this is pretty simple to accomplish in the UI: create a straight table with all three fields, and add an expression like:

IF (Name1 = Name2, 0, 1)

In your script, outer join Table2 To Table 1 and make a copy of the joined table into a second one whereby you use the expression mentioned above to set a Flag to 0 or 1. That way you'll keep the two values if they're available but different.

user-azadi
Contributor III
Contributor III
Author

can you make qvw file sample for more understand,thanks

aarkay29
Specialist
Specialist

May be this


Table2:

LOAD * INLINE [

    Field1, Name2

    2, b2

    4, d2

    5, e2

];

Table1:

LOAD * INLINE [

    Field1, Name1

    1, a1

    2, b1

    3, c1

    4, d1

    5, e1

]

Where not Exists(Field1);

Drop Table

     Table2;

Anil_Babu_Samineni

Here you go

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful