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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
raadwiptec
Creator II
Creator II

map

hi,

How could i map two different field names but the data inside is mostly similiar

for ex as below

Data1.xls has the following data

Transaction  ¦  Account No

22222222222     89776

54545454585     45885

54551854215     96562

Data2.txt

Invoice

22222222222   012

54545454585   011

54551854215   022


Iam trying the following, I dont get any errors.. but in the first try i dont get values,,second try iam getting transaction and not the Account no


[Data1];

Mapping LOAD

Transaction ,

[Account No]


from Data1.xlsx

((ooxml, embedded labels, table is Sheet1);


[Data2];


Load *,

ApplyMap(;Data1',Invoice) as [Account No]

from Data2.txt

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);




Labels (1)
1 Solution

Accepted Solutions
qlikview979
Specialist
Specialist

Hi,

I think your data format is different that's why you are not getting correct output.

Please try like this ,

Data1:

mapping

LOAD num([Transaction ]) as [Transaction ],

     [Account No]

FROM

(ooxml, embedded labels, table is Sheet3);


Data2:

LOAD Invoice,

SubField(Invoice,' ',1) as sub,

ApplyMap('Data1',num(Trim(Left(Invoice,11)))) as AccountNo1

FROM

(ooxml, embedded labels, table is Sheet4);

View solution in original post

18 Replies
swuehl
Champion III
Champion III

Have you enclosed the Map table name in single quotes?

ApplyMap('Data1',Invoice) as [Account No]


edit: In addition, I think you should get an error that field [Account No] already exists in Data1 input table.

jonathandienst
Partner - Champion III
Partner - Champion III

I don't know if they are copy and paste errors, or actual errors in your code, but you have an extra opening parenthesis in the ooxml qualifier and a syntax error in the ApplyMap statement.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
santiago_respane
Specialist
Specialist

Hi,

your code seems fine except for the ";" before Data1 in your applymap sentence and the extra opening parenthesis when reading from Data1 the from sentence.

Should be like this:

[Data2];

Load *,

ApplyMap('Data1',Invoice) as [Account No]

from Data2.txt

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);


Hope this helps.

Kind regards,

ramasaisaksoft
Master
Master

Hi Raadwiptec,

What out put you want at last?

qlikview979
Specialist
Specialist

Hi,

Try like this ,

ApplyMap('Data1',Invoice) as [Account No]

Note:- In your applaymap Statement  Remove           ";"   in front of Data1;

Regardds,

Mahesh.

raadwiptec
Creator II
Creator II
Author

hi all,

sorry what ever u mentioned are copy and paste errors.I dont get any errors.on the reload. I want the [Account No] as the output .based on the mapping betweenTransaction and Invoice.

My Mapiping Load is this

[Data1]:

Mapping LOAD

Transaction ,

[Account No]

from ......xxxx

the only difference between transaction and Invoice is .. in invoice i have spaces with additional 012, 011 and 022 etc

22222222222   012

54545454585   011

54551854215   022


For this above i also tried

[Data2];

Load *,

ApplyMap('Data1',Lesft(Invoice,11) as [Account No]

from Data2.txt

(txt, codepage is 1252, embedded labels, delimiter is ';', msq);


Now currently when i reload.. I get the output as


Account No¦ 

22222222222   

54545454585   

54551854215   

swuehl
Champion III
Champion III

Again there seem to be some typos..

and maybe you are trying to map a text against numeric values, try:

ApplyMap('Data1',Num#(trim(Left(Invoice,11))),'no map of' & Invoice) as [Account No]

qlikview979
Specialist
Specialist

Hi,

I hope it is help full for you .

Try like this

T1:

load * Inline [

Transaction  ,  Account No

22222222222   ,  89776

54545454585  ,   45885

54551854215  ,   96562

];

T2:

mapping load Transaction,

[Account No]

Resident T1;

DROP table T1;

T3:

load * Inline  [

Invoice

22222222222   012

54545454585   011

54551854215   022

];

T4:

load

ApplyMap('T2',SubField(Invoice,' ',1)) as ABC

Resident T3;

DROP table T3;

raadwiptec
Creator II
Creator II
Author

Hi Swehi/Mahes,

I tried both, But it is giving me only output  of transaction data and not the Account no.Neither any errors.