Discussion board where members can get started with Qlik Sense.
I have the following XML section:
<code code="S006" codeSystem="2.16.840.1.113883.4.2188.8.131.52.2" displayName="Comentarios adicionales" />
<title>COMENTARIO SOBRE EL ESTUDIO</title>
and I am reading the attribute (code="S004") using LOAD:
code as Post_Score
FROM [lib://NEW/*.xml](XmlSimple, embedded labels, table is [component/section/code])
WHERE displayName='Comentarios adicionales';
I want to load the letter 'A' instead of "S004". (load 'A' whenever I read "S004)
How can I do that?
Go to Solution.
If(code='S004','A',code) as Post_Score
Thanks a lot Gysbert. What if I need to add several if statements for several possibilities?
If(code='S003','B',code) as Post_Score
You can nest if statements:
if(code='S004','A',if(code='S003','B',code)) as Post_Score
You can use a pick-match combination:
pick(1+match(code, 'S004','S003', ...etc... ), code, 'A', 'B', ...etc) as Post_Score
And if you have a lot of codes to replace you can use a mapping table and the applymap function:
MAPPING LOAD * INLINE [
ApplyMap('mapCodes', code) as Post_Score,