Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Comparing two column values

Hi All,

I have to compare the values present in two columns. But the columns are located in different tables. e.g. I have to compare values of Column A with the values of Column B. Column A is present in Table A whereas Column B is present in table B. How do I compare them in the script?

7 Replies

Re: Comparing two column values

Do you have only one field per table?

Do they have any common column?

What's is expected result?

Yes/NO or values that exist in one column only?

Not applicable

Re: Comparing two column values

Both the tables have multiple columns.

They have a common column.

The expected output should be Yes/No based on the match found.

amarbogam
Contributor

Re: Comparing two column values

I think you should use exists() function if you want to do this in the script.

Re: Comparing two column values

Could you post sample of data?

Partner
Partner

Re: Comparing two column values

Hi,

I think you can bring both field into a temp table, from there you can then use IF statement to check field value and create a YES/NO field. Finally left join or ApplyMap the new field back to any of the tables.

Re: Comparing two column values

09-Apr-15 4-16-08 PM.jpg

T1:

LOAD Num AS Num,

     Boom as Boom1

FROM

COMAPRE.xlsx

(ooxml, embedded labels, table is Sheet1);

temp:

LOAD Num as Num,

lookup('Boom1','Num',Num,'T1') as Boom1, 

     Boom as Boom2

FROM

COMAPRE.xlsx

(ooxml, embedded labels, table is Sheet2);

final:

load Num,

Boom1,

Boom2,

If(Boom1=Boom2,'Yes','No') as Compare

Resident temp;

drop table T1,temp

09-Apr-15 4-14-42 PM.jpg

beck_bakytbek
Honored Contributor

Re: Comparing two column values

Cool Stuff, very useful and powerful

Thanks a lot

Beck