XML creation from data table and template

Hi,
I have a DT with 2 columns “PhoneNumber” & “Message” which is used to send bulk SMS.

I want to populate a XML template with the dynamic values from the input DT, with “to” and “body” mapping to the “PhoneNumber” & “Message” columns of the DT
Can UiPath create this XML template with all the values from the DT?

Please let me know your insights.

Cheers,
Amrutha

I’ve also attached the screenshot of the XML template.
image

Hi @ammohan

Take a look at this

Else if you have all the nodes already then read xml parse it and loop

Cheers

Hi,

Which result do you need?

The following sample outputs the above 2 xml files from datatable.

xeMessage1 = New XElement("messages", New XElement("accountreference", "EX034xxxxxxx"), New XElement("message",  dt.AsEnumerable.Select(Function(r) {New XElement("to",r("PhoneNumber").ToString),New XElement("body",r("Message").ToString)})))

xeMessage2 = New XElement("messages", New XElement("accountreference", "EX034xxxxxxx"),    dt.AsEnumerable.Select(Function(r) New XElement("message", {New XElement("to",r("PhoneNumber").ToString),New XElement("body",r("Message").ToString)})))

Sample20221210-4aL.zip (3.0 KB)

Hope this helps you.

Regards,

Thanks @Yoichi. The second solution worked.

Appreciate your help.

1 Like

Hi @Yoichi,

I am getting this error when I created an exact replica of the workflow in another process. Can you please help me with this issue?


Thanks,
Amrutha

Hi,

Can you try to set parameters as the following?

Regards,

1 Like

Awesome! That worked.

Thank you so much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.