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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
matthewp
Creator III
Creator III

Two tables, two id's and names, only use first name

I have the following load in tab 1 i have

LOAD

SIAA.C_ID as [Customer ID],

SIAA.C_NAME as [Customer name]

FROM

[$(vDetailsQVDDirectory)\SIAA.qvd]

(qvd);

Then in tab 2 i have

PreIT:

Concatenate

LOAD

[Customer ID],

[Customer name]

FROM

[$(vDetailsQVDDirectory)\CTA.qvd]

(qvd);

What i want is if there is a matching Customer ID in both tabs i want it to only use the name from tab 1 (SIAA.C_NAME)

50 Replies
matthewp
Creator III
Creator III
Author

i want to achieve this without mapping

sunny_talwar

Try Joining as mentioned by Kush may be

matthewp
Creator III
Creator III
Author

Ok this has linked them and works for the ones in both tables and uses the correct name.

HOWEVER now ones that are in table 1 but not in table 2 are missing

do i need to do a left join?

sunny_talwar

Have you cleared out all the selection? I would think that the data should be there, might be filtered out due to selections

Kushal_Chawda

I think you need to perform outer join

matthewp
Creator III
Creator III
Author

Actually with a join still getting duplicate id from both table where name is different

sunny_talwar

Yes because the assumption here would be that a single ID will be associated to one and only one name. If that is not true then choose whichever table has the correct names and comment out the name in the other table while joining the two tables.

matthewp
Creator III
Creator III
Author

tried this, just brings the same thing through except the names i dont want are all "-"

Kushal_Chawda

I think Customer Name is not consistent in your table.

Data:

LOAD

SIAA.C_ID as [Customer ID],

SIAA.C_NAME as [Customer name]

1 as Flag1

FROM

[$(vDetailsQVDDirectory)\SIAA.qvd]

(qvd);

join  (Data)

LOAD

[Customer ID],

[Customer name] as [Customer name1]

2 as Flag2

FROM

[$(vDetailsQVDDirectory)\CTA.qvd]

(qvd);

Final:

noconcatenate

LOAD distinct [Customer ID],

if( len(trim(Flag1))>0 or (len(trim(Flag2))>0 and len(trim(Flag1))>0), [Customer name],

[Customer name1] ) as [Customer ID]

resident Data;

drop table Data;

matthewp
Creator III
Creator III
Author

Field names must be unique within table

Final:

noconcatenate

LOAD distinct [Customer ID],

if( len(trim(Flag1))>0 or (len(trim(Flag2))>0 and len(trim(Flag1))>0), [Customer name],

[Customer name1] ) as [Customer ID]

resident Data