Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
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.
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.
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.
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.
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.
It would be helpful if you could post your script.
-Rob
I have attached the script, and the ouput in QlikView.
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
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.