// First step is to join both tables
// Prepare the calculated field TurnoverOrderPosition_Temp
ORDERPOSITION_Temp:
Load
AUFK_NR & '|' & FIRM_NR as %AUFK,
FIRM_NR & '|' & AUFK_NR & '|' & AUFP_NR AS %AUFPdelivered,
AUFP_NR,
ART_NR as %ART_NR,
ART_NR,
AUFP_PREIS2 / AUFP_PEHFAKTOR / AUFP_PREISFAKTOR AS TurnoverOrderPosition_Temp,
From
[lib://QVD/HKTRS2_V_AUFP.qvd]
(qvd)
;
Left Join (ORDERPOSITION)
Load
FIRM_NR & '|' & AUFK_NR & '|' & AUFP_NR AS %AUFPdelivered,
AUFL_MENGE AS DeliveredQuantity
From
[lib://QVD/HKTRS2_V_AUFL.qvd]
(qvd)
;
// Once the tables are joined then we can
// create the final calculation
ORDERPOSITION:
Load
*,
TurnoverOrderPosition_Temp * DeliveredQuantity as TurnoverOrderPosition
Resident
ORDERPOSITION_Temp
;
// we dont need this table anymore
Drop Table ORDERPOSITION_Temp;
// we dont need this field anymore
Drop Field TurnoverOrderPosition_Temp From ORDERPOSITION;