Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
diwaskarki
Creator II
Creator II

what am I doing wrong?

I am extracting the string in between the string tags from the below xml. 

 

<Attributes>
<Map>
<entry key="Cause of Removal" value="Associate Activity"/>
<entry key="Date">
<value>
<Long>1521745344721</Long>
</value>
</entry>
<entry key="Removed Access">
<value>
<List>
<String>Test New Ent</String>

<String> Test New Ent2</String>

<String>Test New Ent3</String>
</List>
</value>
</entry>
<entry key="Requestee" value=" (OE17YR)"/>
</Map>
</Attributes>

 

This is the script I am using: 

IF (ACTION = 'Remove Role Access', TextBetween(Replace(Replace(Replace(Replace(ATTRIBUTES,chr(10),' '),' ', ''), '<String>', ''), '</String>', chr(10)), '<entrykey="RemovedAccess"><value><List>', '</List>')) As [Removed Roles]

 

However, all the spaces in between the string is replaced with non space. In the script, when I replace the non space with space, it does not work. Script runs but does not bring in anything. Any help would be appreciated. Thanks . 

Labels (3)
2 Replies
uacg0009
Partner - Specialist
Partner - Specialist

Hi Diwaskarki,

I think you can try to use textbetween first, like:

IF (ACTION = 'Remove Role Access', Replace(Replace(Replace(TextBetween(ATTRIBUTES,'<entry key="Removed Access">','</List>'),'<value>' & chr(10) & '<List>',''),'<String>',''),'</String>','')) As [Removed Roles]

Please try.

Aiolos Zhao

diwaskarki
Creator II
Creator II
Author

that did not work.