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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

First try with mapping function

Hi there,

I would like to remane some records in a field that's why I used MAPPING function. I put that script just before to load the concerned table.

 

MAPPING:

MAPPING LOAD inline [

Old ,New

"char 1", "new char 1"

"char 2", "new char 2"];

 

map

[fieldName] using MAPPING;

But nothing happened..

Any ideas?

Thank you.

1 Solution

Accepted Solutions
skokenes
Partner - Contributor III
Partner - Contributor III

aquakee,

Try applying the map inline like so:

applymap('MAPPING',[repartition_arrete...]) as [repartition_arrete...]

This should work. I am not sure why the other way does not work.

EDIT: I think it doesn't work because you are loading from a QVD. I wouldn't expect this behavior, but I was able to duplicate it on my machine. When using an Inline table to test instead of a QVD, the "map x using y;" syntax worked fine. It did not work when I tried it with a QVD load.

EDIT2: The source of the error is because when you load directly from the QVD, it performs an optimized load. This will not use the mappings that you have defined. If you want to still use your source QVDs with the original mapping syntax you wrote, you can de-optimize the QVD load. One way to do this is to add a where clause such as:

     Load *

     From

     file.qvd

        (qvd) WHERE 1=1;

Speros

View solution in original post

10 Replies
skokenes
Partner - Contributor III
Partner - Contributor III

Is your "map X using Y;" statement before your load statement where you load the fieldName values?

Not applicable
Author

I put my whole script  before this load.

LOAD

IDF,
COD_,
fieldName

FROM

(
qvd);

skokenes
Partner - Contributor III
Partner - Contributor III

Can you provide a sample of the actual code that does not work?

I've tested the syntax the way you've detailed it with some random data. It works fine. Maybe you have a typo somewhere?

Not applicable
Author

 

MAPPING:

MAPPING LOAD * inline [

Old ,New

"3 à 6 mois", "de 3 à 6 mois"]
;

map [ repartition_arrete_tranche_duree_annuel] using MAPPING;

 

LOAD

IDF_AGENT,

repartition_arrete_tranche_duree_annuel

FROM

(qvd);

Thank you Speros

skokenes
Partner - Contributor III
Partner - Contributor III

It looks like you have an extra space here: map [ repartition_arrete_tranche_duree_annuel] using MAPPING;

Should it say [repartition...] instead of [ repartition...]?

Not applicable
Author

I corrected but it doesn't work..

skokenes
Partner - Contributor III
Partner - Contributor III

Can you clarify how it doesn't work? Does the reload finish? Does the repartition field exist in the resulting data model? Is it populated with the old values?

Not applicable
Author

The reload finishes, the field exists and it is populated with the old values but the name of the record is still the old one.. It doesn't take the new name..

skokenes
Partner - Contributor III
Partner - Contributor III

aquakee,

Try applying the map inline like so:

applymap('MAPPING',[repartition_arrete...]) as [repartition_arrete...]

This should work. I am not sure why the other way does not work.

EDIT: I think it doesn't work because you are loading from a QVD. I wouldn't expect this behavior, but I was able to duplicate it on my machine. When using an Inline table to test instead of a QVD, the "map x using y;" syntax worked fine. It did not work when I tried it with a QVD load.

EDIT2: The source of the error is because when you load directly from the QVD, it performs an optimized load. This will not use the mappings that you have defined. If you want to still use your source QVDs with the original mapping syntax you wrote, you can de-optimize the QVD load. One way to do this is to add a where clause such as:

     Load *

     From

     file.qvd

        (qvd) WHERE 1=1;

Speros