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

Mapping/ApplyMap ignores embedded space

HI all,

I am attempting to apply a mapping to some badly named data.  I want to associate a string with an extra embedded space with the correct spelling with the extra space:

GroupMap:

Mapping load * inline [

string with  extra space, string with extra space,

...

]

...

Load

...

ApplyMap('GroupMap',[Group Name]),

...;

The mapping doesn't take - both instances of the string still appear in the incoming data.  I have tried placing the strings in quotes - double and single - to no avail.  I'm loading from a series of text files.

Has anyone encountered this before?  And hopefully solved it?

1 Solution

Accepted Solutions
pover
Partner - Master
Partner - Master

I don't have any problems with the mapping respecting extra spaces.  It might be the version, but test the following script to see what it gives you.  Maybe the mapping doesn't work because of extra spaces before or after the strings.  If that's the case, use trim(). 

Karl

Map_Table:

Mapping LOAD * INLINE [

    Text_From, Text_To

    test   spaces, test spaces

];

Test_Table:

LOAD * INLINE [

    Text

    test   spaces

];

Test_Table_Fixed:

NoConcatenate

LOAD ApplyMap('Map_Table',Text) as Text

Resident Test_Table;

Drop table Test_Table;

View solution in original post

2 Replies
pover
Partner - Master
Partner - Master

I don't have any problems with the mapping respecting extra spaces.  It might be the version, but test the following script to see what it gives you.  Maybe the mapping doesn't work because of extra spaces before or after the strings.  If that's the case, use trim(). 

Karl

Map_Table:

Mapping LOAD * INLINE [

    Text_From, Text_To

    test   spaces, test spaces

];

Test_Table:

LOAD * INLINE [

    Text

    test   spaces

];

Test_Table_Fixed:

NoConcatenate

LOAD ApplyMap('Map_Table',Text) as Text

Resident Test_Table;

Drop table Test_Table;

Not applicable
Author

I ran the test script and it worked.  Turns out there is a leading space in the bad string.  Thanks for the help!