Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
calebd
Partner - Contributor
Partner - Contributor

Load script: One alias, multiple tables

I've got a base transactional table with a numeric DocType field (20=GRPO, 59=Goods Receipt, 60=Goods Issue). Depending on what value is in that field, I'd like to associate the corresponding DocEntry field with a different table (OPDN, OIGN, OIGE respectively) without generating a synthetic key or a loop. What's the best way to handle that within a load script? I've got a common ItemCode field across all of the tables, as well as a lot# field. The alias is primarily so that I can track the item and lot# accurately.

TRX1.DocTypeTRX1.DocEntry
20212
20214
59A100

 

OPDN.DocEntryOPDN.ItemCode
212Acme_Anvil1
213Engine
214Acme_Anvil5

 

OIGN.DocEntryOIGN.ItemCode
A99Acme_Anvil5
A100Engine

 

Thanks for the assist!

1 Solution

Accepted Solutions
Marcos_rv
Creator II
Creator II

Hi, try this:

TRX1:

load DocType ,

DocEntry,

DocType&'-'&DocEntry  as KEY

FROM TRX1 ...

 

 

ITEM:

LOAD

'20'&'-'DocEntry  AS KEY

ItemCode

FROM  OPDN ....

CONCATENATE(ITEM)

LOAD 

'59'&'-'DocEntry  AS KEY

ItemCode

FROM OIGN ....

CONCATENATE (ITEM)

....

You would have a single table that joins the transactional according to the code.

 

 

 

View solution in original post

2 Replies
dplr-rn
Partner - Master III
Partner - Master III

Dont know the full scale of the issue but try concatenating OPDN and OIGN table.
maybe create another column to identify it.
e.g.
SomeName:
load DocEntry
, ItemCode
, 'OPDN' as type
from ....OPDN

concatenate(SomeName)
load DocEntry
, ItemCode
, 'OIGN' as type
from ....OIGN
Marcos_rv
Creator II
Creator II

Hi, try this:

TRX1:

load DocType ,

DocEntry,

DocType&'-'&DocEntry  as KEY

FROM TRX1 ...

 

 

ITEM:

LOAD

'20'&'-'DocEntry  AS KEY

ItemCode

FROM  OPDN ....

CONCATENATE(ITEM)

LOAD 

'59'&'-'DocEntry  AS KEY

ItemCode

FROM OIGN ....

CONCATENATE (ITEM)

....

You would have a single table that joins the transactional according to the code.