Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
14 replies
Subscribers
7 subscribers
Views
6606 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
I want to achieve as below: document as - XML file contains list of u
dhavals
over 11 years ago
I want to achieve as below:
document as - XML file contains list of user node where each user node contains number of element describing user information.
Now, I want to fetch the user node block (all child nodes) match to appian login id and user node's login id child node.
Can any one share me which Appian activity or service would i have to use and how to achieve this.
Thank you...
OriginalPostID-83335
OriginalPostID-83335
Discussion posts and replies are publicly visible
0
Siva
Certified Lead Developer
over 11 years ago
Hi Dhaval,
You can use Appian out of the box function xpathdocument(). You can write an Xpath expression to get the node from an XML document.
For more about the function here is the link
forum.appian.com/.../Scripting_Functions
More about Xpath Expression
www.w3schools.com/.../xpath_syntax.asp
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
dhavals
over 11 years ago
It did not work, please see below as i tried:
1. my xml look as below:
<?xml version="1.0" encoding="utf-8"?>
<APPUSER>
<APPAINID>dhaval.soni</APPAINID>
<NAME>Mark</NAME>
<WEB>www.companysite.com</WEB>
</APPUSER>
<APPUSER>
<APPAINID>d.soni</APPAINID>
<NAME>Williamson</NAME>
<WEB>www.companysite.com</WEB>
</APPUSER>
tried function as follow:
=xpathdocument(cons!AppSignatureXMLFile,"/ADJUSTER[APPAINID='dhaval.soni']")
//cons!AppSignatureXMLFile contains XML document object , [also tried by document id]
tried to assign its resolve into process variable but it did not get assign and process variable shows empty only.
NOTE: have also tried by passing "ns" prefix , by removing <?xml version...> but it did not work.
please suggest me what is wrong here.
thank you
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
akhileshn
over 11 years ago
Two issues
1) There is no ADJUSTER tag in xml, xpath expression is incorrect
2) Enclose your xml in a single parent tag, make is something like <root><!-- add your xml here --></root>
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
dhavals
over 11 years ago
Its my mistake to paste ADJUSTER as its not in actual. In XML, as you say, i will add one extra parent node.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Siva
Certified Lead Developer
over 11 years ago
You can't compare the value directly using Xpath expression like APPAINID='dhaval.soni'.
Change your Xpath expression as below
=xpathdocument(cons!AppSignatureXMLFile,"//APPAINID")
Output will be
<APPAINID>dhaval.soni</APPAINID>
Then you have to extract the value (dhaval.soni) from the output string.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
dhavals
over 11 years ago
No luck.
I have added root node as APPUSERS so, XML look as below:
<?xml version="1.0" encoding="utf-8"?>
<APPUSERS>
<APPUSER>
<APPAINID>dhaval.soni</APPAINID>
<NAME>Mark</NAME>
<WEB>www.companysite.com</WEB>
</APPUSER>
<APPUSER>
<APPAINID>d.soni</APPAINID>
<NAME>Williamson</NAME>
<WEB>www.companysite.com</WEB>
</APPUSER>
</APPUSERS>
tried below function:
xpathdocument(cons!AppSignatureXMLFile,"/APPUSERS/APPUSER")
also tried
xpathdocument(cons!AppSignatureXMLFile,"/APPUSERS/APPUSER[1]")
or
xpathdocument(cons!AppSignatureXMLFile,"//APPAINID")
None of above worked..
I have applied process vaiable assignment on - USER INPUT ACTIVITY TASK >> OUTPUT - CUSTOM VARIABLE - ASSIGNING EXRPESSION TO PROCESS VARIABLES.
but all process variables shows me empty while i see after executing this task in debug mode.
do i have to give some prefix ?, in my XML exactly look as above.
please suggest me what is still wrong.
thanks.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Siva
Certified Lead Developer
over 11 years ago
I have tried the below expression in Rules tab
xpathdocument(ri!XMLFile,"//APPAINID")
Output is array of APPAINID nodes
<APPAINID>dhaval.soni</APPAINID>, <APPAINID>d.soni</APPAINID>
Can you check your constant has valid document or not?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
dhavals
over 11 years ago
it is correct one , have created "document" type constant and assigned there XML file. for now, its fine to see array of APPAINID.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
dhavals
over 11 years ago
i mean, still not working.. constant has correct XML and type is document.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
dhavals
over 11 years ago
Else case, please provide any other option exists in APPIAN which can allow me to fetch XML value.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>