Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
gayathridevi24
Contributor III
Contributor III

Combine two tables according to the condition

Hi All, Is there possible to combine two tables and load requested field according to the condition in back end. example: There is two table as follows: emp: load Employee Number, Employee First Name, Employee Last Name, Gender dept: load Employee Number, Dept No, Dept Name, Location output: i want to get all fields as follows if location is bangalore Employee Number Employee Name Gender Dept No Dept Name and if location is Hyderabad, i want all these fields as follows Employee Number Employee Name Gender Dept No Dept Name Could anyone please guide me in this. Thanks and Regards, Gayathri Devi
6 Replies
Vegar
MVP
MVP

I don't understand your question as you are listing the same field names for both conditions, Hyderabad and Bangalore.

- Employee Number
- Employee Name
- Gender Dept No
- Dept Name
jonathandienst
Partner - Champion III
Partner - Champion III

Just load the two tables. Qlik will associate them by the common field, employee number and will allow you to see the employee and department details as per your requirement.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
gayathridevi24
Contributor III
Contributor III
Author

Hi Vegar,

 

It is like case transform, whether it is possible to implement in qlikview.

this is one table

Employee NumberEmployee First NameEmployee Last NameGender
1001AparnaSF
1002AradhyaMF
1003AryaPM
1004ChandraPM
1005ChinnappaReddyM
1006JaganEM
1007JayakumarCM
1008PraveenGarelaM
1009PriyaMF
1010RajeshPM
1011RangaduPoolaM

 

Another Table:

10011TechnologyBangalore
10021TechnologyBangalore
10031TechnologyBangalore
10041TechnologyBangalore
10051TechnologyBangalore
10061TechnologyBangalore
10071TechnologyBangalore
10081TechnologyBangalore
10091TechnologyHyderabad
10101TechnologyHyderabad
10111TechnologyHyderabad

 

I want output as follows and should be done in back end.

It should load only matching field from two tables according to the Bangalore location

Employee NumberEmployee First NameEmployee Last NameGenderDept NoDept Name
1001AparnaSF1Technology
1002AradhyaMF1Technology
1003AryaPM1Technology
1004ChandraPM1Technology
1005ChinnappaReddyM1Technology
1006JaganEM1Technology
1007JayakumarCM1Technology
1008PraveenGarelaM1Technology

It should load only matching field from two tables according to the Hyderabad location.

1009PriyaMF1Technology
1010RajeshPM1Technology
1011RangaduPoolaM1Technology

could you please guide me in this.

Thanks and regards,

Gayathri

Vegar
MVP
MVP

MasterData:
LOAD [Employee Number], 
     [Employee First Name], 
     [Employee Last Name], 
     Gender
FROM
[https://community.qlik.com/t5/New-to-QlikView/Combine-two-tables-according-to-the-condition/m-p/1551653#M370958]
(html, codepage is 1252, embedded labels, table is @1);


LEFT JOIN (MasterData)
LOAD @1 as [Employee Number] , 
     @2 as [Dept No], 
     @3 as [Dept Name], 
     @4 as Location 
FROM
[https://community.qlik.com/t5/New-to-QlikView/Combine-two-tables-according-to-the-condition/m-p/1551653#M370958]
(html, codepage is 1252, no labels, table is @2);


This script will join your tables together into one you could create an app like this. 

BanglaHypera.gif

I added  a qvw where I included script to fetch only one location. You need to uncomment the script.

gayathridevi24
Contributor III
Contributor III
Author

Hi Vegar,

Thank u so much for your reply, 

After removing the comments also, the script which you have given doesn't work for me.

Could you please help me to solve this.

 

Thanks and Regards,

Gayathri

Vegar
MVP
MVP

It works for me so it is hard to help you with this issue.

 

Try to replace the FROM [http://community.qlik.com/......] with your acutal source files/databases.