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

Transforming data with Mapping

Hi guys,

I have a table of data like this:

ItemCount(Item)
O100
U200
A300
P400

I want to replace P with Present in the load script. So I have done:

MarksMap:

MAPPING LOAD * INLINE [

  P, Present

];

at the top of the load script and then:

LOAD *,

ApplyMap('MarksMap', Mark) Inline;

SQL SELECT...

in my preload script before I actually load the data from the database. But the value stays at 'P' in the table.

What am I doing wrong?

1 Solution

Accepted Solutions
Not applicable
Author

Have you tried assign a column name to the fields in your table

e.g.

MarksMap:

MAPPING LOAD * INLINE [

Heading, Description

  P, Present

];

View solution in original post

5 Replies
Anonymous
Not applicable
Author

try this (Change in bold)

BUT check: your table says that field is Item, so in applymap Item instead of Mark should be used!

MarksMap:

MAPPING LOAD * INLINE [

  P, Present

];

at the top of the load script and then:

LOAD *,

ApplyMap('MarksMap', Mark) as Present;

SQL SELECT...

Not applicable
Author

Have you tried assign a column name to the fields in your table

e.g.

MarksMap:

MAPPING LOAD * INLINE [

Heading, Description

  P, Present

];

Anonymous
Not applicable
Author

Here you go

MarksMap:

MAPPING LOAD * INLINE [

   Col1, Col2

  P, Present

];

at the top of the load script and then:

LOAD *,

ApplyMap('MarksMap', Mark) as Present

;

SQL SELECT...

Edit:  The first row of your inline table will always be the column names separated by a comma.  The rest of the rows will be the data.

Anonymous
Not applicable
Author

Iam not really sure if this helps. your code is a little confusing.

can you post an example qvw?

Not applicable
Author

It's OK, all the answers on here helped me figure it out.

My load map now looks like this:

MarksMap:

MAPPING LOAD * INLINE [

  Mark, Description

  P, Present,

  A, Authorised,

  U, Unauthorised,

  O, Offsite

];

and my preload:

LOAD *,

ApplyMap('MarksMap', Mark, null()) as Description;

Thanks to everyone for their help; this community is fantastic!