Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
matthewp
Creator III
Creator III

renaming values in load script with multiple mappings

So currently i have this small script which pulls data from an old qvd and also a new qvd which has a grouping field.

However i want to be able to rename some of the fields as they use slightly different variations in their spelling.

------------------------------------------------------------------------------------------------------------------------------------------------------------------

bnewstructure:

Mapping LOAD

B_DESC AS [bname],

B_GROUP AS [bgroup]

FROM

bnewstructure:

(qvd);

Details:

load

ApplyMap('bnewstructure:',[B name],'Missing') as [Mapped group],

*;

LOAD

boldstructure.B_DESC as [B name]

FROM

[$(vDetailsQVDDirectory)\boldstructure.qvd]

(qvd);

------------------------------------------------------------------------------------------------------------------------------------------------------------------


This returns for example:

Mapped group

Grouped companies

Grouped cos


So i thought about adding another mapping field to address this but it didn't work:

------------------------------------------------------------------------------------------------------------------------------------------------------------------


MAPPING:

MAPPING LOAD * inline [

Grouped cos, Grouped companies];

map [Mapped group] using MAPPING;

------------------------------------------------------------------------------------------------------------------------------------------------------------------


This was added between the first map and the first load like this:

------------------------------------------------------------------------------------------------------------------------------------------------------------------


bnewstructure:

Mapping LOAD

B_DESC AS [bname],

B_GROUP AS [bgroup]

FROM

bnewstructure:

(qvd);

MAPPING:

MAPPING LOAD * inline [

Grouped cos, Grouped companies];

map [Mapped group] using MAPPING;

Details:

load

ApplyMap('bnewstructure:',[B name],'Missing') as [Mapped group],

*;

LOAD

boldstructure.B_DESC as [B name]

FROM

[$(vDetailsQVDDirectory)\boldstructure.qvd]

(qvd);

------------------------------------------------------------------------------------------------------------------------------------------------------------------


1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think you are missing field names in your second map:

MAPPING:

MAPPING LOAD * inline [

IN, OUT

Grouped cos, Grouped companies

];

And what about [Mapped group] field values that don't appear in the MAPPING list of values?

View solution in original post

1 Reply
swuehl
MVP
MVP

I think you are missing field names in your second map:

MAPPING:

MAPPING LOAD * inline [

IN, OUT

Grouped cos, Grouped companies

];

And what about [Mapped group] field values that don't appear in the MAPPING list of values?