I am having process model which scheduled to run after every hour and get XML response from external system and storing into text type pv.
XML data in nested CDT format.
Now, We want to read that XML file into Appian CDT. For reference i am giving below XML response.
<variable type="InputBO"> <paymentInfo type="PaymentBO"> <operationType type="String">CAPTURE</operationType> <channelId type="String">AAA</channelId> <paymentTypeCode type="String">BBB</paymentTypeCode> <referenceNumber type="String">ABCD145891</referenceNumber> <paymentAmount type="Decimal">515.0</paymentAmount> <paymentCurrency type="String">GBP</paymentCurrency> <paymentCardDetails type="PaymentCardDetailsBO"> </paymentInfo></variable>
Could you please help me to achieve this task? Thanks for your support in advance.(Appian version 18.1)
Discussion posts and replies are publicly visible
Hi Vinod,
Please try below expression:
type!Your_CDTName(
operationType: extract(ri!XMLText,"String"&Char(34)&">","</operationType")[1],
channelId:extract(ri!XMLText,"channelId type="&Char(34)&"String"&Char(34)&">","</channelId")[1],
paymentTypeCode:extract(ri!XMLText,"paymentTypeCode type="&Char(34)&"String"&Char(34)&">","</paymentTypeCode")[1],
referenceNumber:extract(ri!XMLText,"referenceNumber type="&Char(34)&"String"&Char(34)&">","</referenceNumber")[1],
paymentAmount:extract(ri!XMLText,"paymentAmount type="&Char(34)&"Decimal"&Char(34)&">","</paymentAmount")[1],
paymentCurrency:extract(ri!XMLText,"paymentCurrency type="&Char(34)&"String"&Char(34)&">","</paymentCurrency")[1]
)
ri!XMLText: Text type input
Replace Your_CDTName with your CDT name. Pass complete xml text as an input ri!XMLText. Hopefully this will resolve your problem.