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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rmendoza
Contributor II
Contributor II

Generate code when joining two tables

Hello community
How can I generate a code when joining two tables?

Example:

Tabla 1 (Database) + 200 records

rmendoza_2-1713958093717.png

Tabla 2(Database) + 200 records

rmendoza_1-1713958007413.png

Table 3(Excel) has the code... depending on the condition. (+ 200 records...many combinations)

rmendoza_3-1713958176493.png

thanks for your time.

cheers

Renzo

 

 

Labels (4)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master II
Partner - Master II

Try

ExcelMap:
Mapping LOAD 
Hash128("ID-PAR",ID,Marca,Color,...),
"TYP-ID"
From ...Sheet1:

ExcelExist:
LOAD 
Hash128("ID-PAR",ID,Marca,Color,...) as KeyToCheck
From ...Sheet1:

TMP:
LOAD *,
Hash128("ID-PAR",ID,Marca,Color,...) as Key;

//T1:
LOAD * From Table1;

Join

T2:
LOAD * From Table2;

Final:
LOAD *,
If(Exists(KeyToCheck,Key),ApplyMap('ExcelMap',Key,'No ID')) as "TYP-ID"
Resident TMP;

DROP ExcelExist,Table TMP;
DROP Field Key;

View solution in original post

4 Replies
BrunPierre
Partner - Master II
Partner - Master II

Could you elaborate?

rmendoza
Contributor II
Contributor II
Author

Hi @BrunPierre 

I receive an excel with many combinations.
Each combination has a code.
Now when loading the 2 tables from the database, I have to check if an Excel combination exists and if it exists I give it the code.

 

Cheers

Renzo

BrunPierre
Partner - Master II
Partner - Master II

Try

ExcelMap:
Mapping LOAD 
Hash128("ID-PAR",ID,Marca,Color,...),
"TYP-ID"
From ...Sheet1:

ExcelExist:
LOAD 
Hash128("ID-PAR",ID,Marca,Color,...) as KeyToCheck
From ...Sheet1:

TMP:
LOAD *,
Hash128("ID-PAR",ID,Marca,Color,...) as Key;

//T1:
LOAD * From Table1;

Join

T2:
LOAD * From Table2;

Final:
LOAD *,
If(Exists(KeyToCheck,Key),ApplyMap('ExcelMap',Key,'No ID')) as "TYP-ID"
Resident TMP;

DROP ExcelExist,Table TMP;
DROP Field Key;
rmendoza
Contributor II
Contributor II
Author

Hello @BrunPierre 

Great. Thank you so much.

 

Cheers!

Renzo