Hi,
I have an XML variable "myXML" which is set to:
<root>
<nodes>
<node>
<value>a</value>
</node>
<node>
<value>b</value>
</node>
</nodes>
</root>
Question - within an Execute script, how can I easily access and update the second node value? i.e. change "b" to "c"
The following fails in Execute Script (although it is possible using an XPath expression in a SetValue
patExecContext.setProcessDataValue("/process_data/myXML/root/nodes/node[1]/value", "c");
If I have square brackets in this expression then it fails with a nasty error
Is there an easy way?
Views
Replies
Total Likes
No need of ExecuteScript activity for this simple assignment.
You can try this XPATH expression:
and the value is "c"
Please note that the node index starts from 1,2 and so on.
Nith
Views
Replies
Total Likes
Thanks Nith ... I know I can do this with a SetValue.
But I need to do it inside an Execute Script call .. it's part of logic (loops, conditions etc), that are much too big and complex to use regular tasks in a process...
This is running in a script of 80 or so lines of code ....
Is it possible?
Views
Replies
Total Likes
I tired your script in my sandbox and its working fine without fail.
I noticed an additional space in your xpath expression
Can you remove the space within node tag and try again?
Nith
Really? Because I get a nasty error "Internal error"
It's not working at all on two systems.
And sorry, that pace was a copy / paste problem .. it's not in my code....
Views
Replies
Total Likes
Share your email with me nith@mof.gov.bh
I will send your the process template to view the code.
Nith
Views
Replies
Total Likes
Hi Nith,
I'll send you an e-mail now. Strangley enough, I restarted the App Server and it's working.
Bizarre.
Thanks
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies