Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Foodie123
Contributor III
Contributor III

ApplyMap & Formatting (Spaces and Capital letters in between words)

Hello Experts,

I using an applymap function but for some reason, it is not recognizing words with spaces and capital letters in between.

For instance, I am trying to change Mclennan to McLennan but it is counting these words separately. 

Another instance, I am trying to change Fairfax City to Fairfax but it is counting these words separately.

Why is this? 

Thank you in advance!

Labels (1)
1 Solution

Accepted Solutions
Foodie123
Contributor III
Contributor III
Author

Thank you everyone for your help! I figured out that I wasn't applying the applymap function to the other county fields mentioned in the script- I only applied it to one of them, so it was bringing back the old county names.

View solution in original post

8 Replies
Or
MVP
MVP

Not quite sure what you're asking here. ApplyMap() finds a matching string in the mapping table and returns the corresponding value. It shouldn't care what's actually inside that string, including capital letters and spaces, as long as it perfectly matches. Do note that matches are case sensitive.

Foodie123
Contributor III
Contributor III
Author

Sorry, my problem is that the strings inside the mapping table matches but it isn't returning the corresponding value I want it to. It seems to be outputting the source value instead. I have attached what I have in the mapping table and what is outputted to me. 

marcus_sommer

I think the values between the mapping table and applymap-call do not match. Like mentioned they must be absolute exactly the same. This means you may need some further measures to ensure a matching respectively to simply it, for example something like this:

applymap('m', upper(trim(keepchar(Field, 'ABC...Z'))), 'no match of: ' & Field)

and of course the values within the mapping are equally adjusted. Further without adding the third parameter of applymap() the call-value is returned in the case of a non-matching - with the above shown string-prefix you will see which values are mapped and which not.

Foodie123
Contributor III
Contributor III
Author

Thank you Marcus, I tried that function and it shows that there is a match with one of the strings but it is outputting it's source value still and not the one I want it to change to. 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It would be helpful if you could post your script. 

-Rob

Foodie123
Contributor III
Contributor III
Author

I have attached the script, and the ouput in QlikView.

Foodie123_3-1684256800302.png

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Nested functions are executed from the inside out, so Upper is being executed last. If you are trying to harmonize the values I think you want Upper on the inside:

KeepChar(Upper(Trim(Old)), 'ABCD...') as Old

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

Foodie123
Contributor III
Contributor III
Author

Thank you everyone for your help! I figured out that I wasn't applying the applymap function to the other county fields mentioned in the script- I only applied it to one of them, so it was bringing back the old county names.