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

Multiple tables with 2 fields and replacing them with applymap

Hi All,

Below is the code,


Tablelist:

LOAD * INLINE [

    Tablelist, Key Field

TPLANT, %Plant_PLANT

TMATERIAL, %Material_MATERIAL

MMATERIAL, %Material_MATERIAL

Bill-to TCUSTOMER, %Bill-to party_BILLTOPRTY

Bill-to MCUSTOMER, %Bill-to party_BILLTOPRTY

Ship-to TCUSTOMER, %Ship-To Party_SHIP_TO

Ship-to MCUSTOMER, %Ship-To Party_SHIP_TO

Sold-to TCUSTOMER, %Sold-to Party_SOLD_TO

Sold-to MCUSTOMER, %Sold-to Party_SOLD_TO

Sold-to TINDUSTRY, %Sold-to Industry_INDUSTRY

Bill-to TINDUSTRY, %Bill-to Industry_INDUSTRY

TDOC_TYPE, %Sales doc. type_DOC_TYPE

TPROFIT_CTR, %CO_AREA_PROFIT_CTR

TSALES_OFF, %Sales Office_SALES_OFF

TDISTR_CHAN, %Distribution Channel_DISTR_CHAN

TSALESORG, %Sales Organization_SALESORG

TBILL_TYPE, %Billing type_BILL_TYPE

TMATL_GROUP, %Material group_MATL_GROUP

TMATL_GRP_1, %MaterialGroup 1_MATL_GRP_1

TMATL_GRP_2, %MaterialGroup 2_MATL_GRP_2

TMATL_GRP_3, %MaterialGroup 3_MATL_GRP_3

Sold-to TACCNT_GRP, %Sold-to Account group_ACCNT_GRP

TSALES_DIST, %Sales District_SALES_DIST

MSALES_DIST, %Sales District_SALES_DIST

TORD_REASON, %Reason for order_ORD_REASON

TITEM_CATEG, %Item category_ITEM_CATEG

Sales Order TITEM_CATEG, %Sales Order Item category_ITEM_CATEG

TSHIP_POINT, %Shipping point_SHIP_POINT

MSHIP_POINT, %Shipping point_SHIP_POINT

TFACS, %Factory Calendar ID_IDENT

Sold-to TCOUNTRY, %Sold-to Country_COUNTRY

Bill-to TCOUNTRY, %Bill-to Country_COUNTRY

TBILL_CAT, %Billing category_BILL_CAT

TREASON_REJ, %Reason for rejection_REASON_REJ

MWBS_ELEMT, %WBS Element_WBS_ELEMT

TWBS_ELEMT, %WBS Element_WBS_ELEMT

TPROJECT, %Project Definition_PROJECT

TDIVISION, %Division_DIVISION

    SalesRep, %Sales Representative_SALESEMPLY

    TSUB_REASON, %Reason for substitution_SUB_REASON

    TDLV_STS, %Delivery Status_DLV_STS

    TPROD_HIER1, %Prod.hierarchy_PROD_HIER_1

    TPROD_HIER2, %Prod.hierarchy_PROD_HIER_2

    TPROFIT_CTR_BILLING, %CO_AREA_PROFIT_CTR_BILLING

    Payer TCUSTOMER, %Payer_PAYER

    Sold-to TREGION, %Sold-to Region_REGION

    Ship-to TREGION, %Ship-to Region_REGION

    TDEL_BLOCK, %Delivery block_DEL_BLOCK

    TBILL_BLOCK, %Billing block_BILL_BLOCK

    TBILL_BLOCK_HEADER, %Billing block header_BILL_BLOCK

    TLOAD_PT, %Loading point_LOAD_PT

    Trading Partner TCOMP_CODE, %Trading Partner_ZVBUND

    Partner Profit Center TPROFIT_CTR, %Partner profit center_PART_PRCTR

    PersonResponsible, %Person Responsible_PS_RESPNO

    TDLV_PRIO, %Delivery priority_DLV_PRIO

    TSHIP_TYPE, %Shipping Type_SHIP_TYPE

    Service Branch TSALES_OFF, %Service Branch_/BIC/ZIKSDSB1

    TZOFFERSTS, %Status of Offer_/BIC/ZOFFERSTS

    MATERIAL_TPROD_HIER1, %Material Prod.hierarchy_PROD_HIER_1

    MATERIAL_TPROD_HIER2, %Material Prod.hierarchy_PROD_HIER_2

    MATERIAL_TPROD_HIER3, %Material Prod.hierarchy_PROD_HIER_3

    PROFIT_CTRH, %CO_AREA_PROFIT_CTR

    TMLST_USE, Billing Plan Milestone Code

    TMILESTONE, %Milestone_MILESTONE

    TSCHD_CATEG, %Sched.line category_SCHD_CATEG

    Ship-to TCOUNTRY, %Ship-to Country_COUNTRY

    TVENDOR, %Vendor_VENDOR

    TDOCTYPE, %Purchasing document type_DOCTYPE   

];


For vValueNo = 1 to NoOfRows('Tablelist')


LET Tablename =  peek('Tablelist', $(vValueNo)-1,'Tablelist');

LET KeyField =  peek('Key Field', $(vValueNo)-1,'Tablelist');


[$(Tablename)]:

LOAD

*

From

[$(Tablename).QVD]

(qvd)

Where Exists([$(KeyField)])

;


Next vValueNo


DROP Table Tablelist;




In above code they have listed table name and PK combination.

They have generated multiple tables and due to this data model is heavy.

All of these tables are containing 2 fields May I know how to replace above code with applymap and mapping load.



Thanks

1 Reply
kishorj1982
Creator II
Creator II
Author

Hi All,

Could you please suggest on this.

Thanks