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
13 replies
Subscribers
7 subscribers
Views
4200 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
how can I convert an xml to cdt... and I want to use it directly in a rule... ..
lianl
over 10 years ago
how can I convert an xml to cdt... and I want to use it directly in a rule... ...
OriginalPostID-102912
OriginalPostID-102912
Discussion posts and replies are publicly visible
0
Eduardo Fuentes
Appian Employee
over 10 years ago
forum.appian.com/.../Scripting_Functions
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
lianl
over 10 years ago
thank you but as you can see it metioned "The result of this function is not automatically saved into the process variable passed in the type parameter. You must store the result of this function into a process variable."
which I mean to evaluate automatically without storing the result...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
lianl
over 10 years ago
or is there xml to json smart service? that would solve it as well...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Sathya Srinivasan
Appian Employee
over 10 years ago
Have you made sure that the namespace is correctly matched? The best way is to use TOXML() function on the CDT so you get the XML representation of the CDT and ensure that your XML maps to this structure.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
lianl
over 10 years ago
thanks but that's not the issue...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 10 years ago
Can you explain why this statement is a concern for your use case? "The result of this function is not automatically saved into the process variable " this is mentioned in the documentation just for users not to think that the data is directly saved, this warning is just a reminder that if you want to store the output to a variable you have to do it the same way you do it with other expressions: using a custom output or node input mapped to a variable.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
lianl
over 10 years ago
I use a string (xml format) which is returned by callling webserivce by httpget().
I would like to directly convert it to CDT.
using torecord() I realised torecord() must be used inside a process and have reference to datatype.
I would like to know if there is a way to convert it directly in a function?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
janakik
over 10 years ago
We have the same requirement, i dont want to create a acp/pv of CDT type. So without explicity having ACP/PV can we direclty convert the xml code to CDT.
Note: We are doing this conversion in SAIL
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
janakik
over 10 years ago
Solution to directly convert without creating ACP/PV,
torecord(XMLText,'type!testCDT'()), here 1st parameter would be your XML variable and 2nd parameter would be the CDT type.
Thanks!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
lianl
over 10 years ago
I tried your solution but I get this:
There was an error testing the rule:
Expression evaluation error at function 'torecord' parameter 2: Invalid function 'type!ArrayOfDPEntity' due to invalid type
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
>