Skip to main content
Announcements
See why Qlik was named a Leader in the 2024 Gartner® Magic Quadrant™ for Data Integration Tools for the ninth year in a row: Get the report
cancel
Showing results for 
Search instead for 
Did you mean: 
akpofureenughwu
Creator III
Creator III

A little help in a mapping statement

Hello sir,

I have been using the mapping statement but I'm encountering a challenge.

Here is the structure of the data

FIRS

DateCompanyStateDocument NumberTIN Cost
01/01/2016XYZEdoAD1232FD3423r1200
01/01/2016Joe OUTSOURCING LIMEdoAF3454GF1230d200
01/02/2017Aerobrown EnterpDeltaDFg454fd1245f100

Type

CompanyType
XYZ Cold
Joe OUTSOURCING LIMITED

Hot

Aerobrown EnterpriseCold

Here is my script:

TypeMap:

Mapping LOAD

    Company,

    "Type"

from source.....

[DATE] AS [Document Date],

    Company,

    ApplyMap('TypeMap', 'Company',null()) as Type,

    [State],

    XXXX

    XXXX

from source.

some how the type is blank after running the script, Please what do you think? 

   .

17 Replies
akpofureenughwu
Creator III
Creator III
Author

prieper

Thank you for commenting... Company Code is the deal!! I just review the sheets. I can map with the company code. Let me check it out. Will be back.

Thanks 

antoniotiman
Master III
Master III

May be like this

MapTable:
Mapping
LOAD Left(Company,If(Index(Company,' ',-1) > 0,Index(Company,' ',-1),999)) as Company,
'{<'&Type&'>}'
FROM
https://community.qlik.com/message/1375658
(html, codepage is 1252, embedded labels, table is @2);
LOAD Date,
Company,
State,
[Document Number],
TIN,
Cost,TextBetween(MapSubString('MapTable',Company),'{<','>}') as Type
FROM
https://community.qlik.com/message/1375658
(html, codepage is 1252, embedded labels, table is
@1);

akpofureenughwu
Creator III
Creator III
Author

prieper stalwar1 antoniotiman techvarun

I want to use vendor id as the mapping variable. Thank you for your contributions

Regards 

akpofureenughwu
Creator III
Creator III
Author

Hey

I reviewed the script to use vendor id as the mapping variable since the vendor id is constant even if the data entry operator spell the company's name irregularity. I edit the script you proposed but I'm having an error.

Check it out:

BP:

load*,

if( Isnum(Date), 'Q')& Ceil(Month(Date)/3) as Quarter,

'Day '&Day(Date)&' '&Month as [Day Number];

load*,

Year("Date") as Year,

Month("Date") as Month,

Day("Date") as Day;

FIRS:

LOAD

    "DATE",

    Company,

          [State],

     if("State" = 'DT','Delta',

     if("State" = 'ED','Edo',

     if("State" = 'LA','Lagos',

     if("State" = 'RV','Rivers',

     if("State"= 'FC','FCT',

     if("State"= 'AB','Asaba',

      if("State"= 'OG','Ogun',

      if("State"= 'OY','Oyo',

      if("State"= 'KD','Kaduna',

       if("State"= 'EB','Ebonyi',

     if("State" = 'IM','IMO',"State"))))))))))) as [State Group],

    State,

    FIRS,

    Account,

    SGN,

    "Document Number",

    Vendor,

    "Profit Ctr",

    "TIN Number",

    "Type",

    "Amount in doc. curr.",

    Curr.,

    "Amount in local currency",

    LCurr,

    PK,

    "Pstng Date",

    date( date#([Pstng Date],'DD.MM.YYYY'),'DD/MM/YYYY')  as Date

FROM source1.xlsx;

Type:

Mapping LOAD

    "Type",

    Vendor

FROM source.xlsx;

TypeMap: 

MAPPING LOAD Vendor, Type Resident Type; 

Drop Table Type;

Load     ApplyMap('TypeMap', Vendor,null()) as Type,* Resident FIRS;

DROP TABLE FIRS

Please help me revieew

techvarun
Specialist II
Specialist II

Share sample data

akpofureenughwu
Creator III
Creator III
Author

Kindly find the attached file.

antoniotiman
Master III
Master III

TypeMap:

Mapping LOAD

    [Vendor ID],Type

FROM source.xlsx;

TypeMap: 

MAPPING LOAD Vendor, Type Resident Type; 

Drop Table Type;

akpofureenughwu
Creator III
Creator III
Author

Hello bro,

Any luck?

Regards