Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Can someone tell me how to change the text of something in the script?
I am wanting to make several slight changes to a column for example I would like to make such changes like "Assets London" to "Ass London" and "Assets Manchester" to "Ass Manchester" without having to create another column?
Thanks,
Ben
Hi Ben, you can use a mapping table, this is a table with 2 columns: one iis the value to search and the 2nd the value returned.
mapText:
LOAD * inline [
TextFrom, TextTo
Assets London, Ass London
Assets Manchester, Ass Manchester
];
And use applymap when loading the text field:
LOAD
Applymap('mapText', TextField) as TextField
...
If some value is not found in the mapText table the default value is kept.
May be use a Mapping load to get this resolved
LivingQlik Roots: The Complete Guide to QlikView Mapping Load
Hi Ruben,
Thanks for getting back to me, I tried adding the below to my coding but it did not like it. I am pretty much new to Qlikview so it is pretty alien to me, but enjoying the challenge. Are you able to help me some more?
Thanks,
Ben
LOAD * inline [
TextFrom, TextTo
Assets London, Ass London
Assets Manchester, Ass Manchester
];
I think you missed the Mapping keyword
MappingTable:
Mapping
LOAD * inline [
TextFrom, TextTo
Assets London, Ass London
Assets Manchester, Ass Manchester
];
Ha ha, that's a really bad abbrv. for Assets!
Andy
Thanks Sunny,
I am still getting a script error saying: Field Not Found - <Business Unit> followed by the script I tried to add?
Thanks,
Ben
Another option would be to use replace() to change 'Assets' to 'Ass'
Something along the lines of
Load
replace(your_field_name, 'Assets', 'Ass') as your_field_name,
....
from .... ;
You can also nest multiple replace statements together
replace(replace(your_field_name, 'Assets', 'Ass'), 'AAA', XXX') as your_field_name,
If there are lots of changes, then the mapping table method is easier to maintain.