Forum Discussion
Anonymous
7 years agoNot applicable
converting column to XML string
Hi, I'm new to Power BI. But I'm trying to POST a SOAP request which takes input as xml. I have a query (name Headerids) that has a column name xmltaskids. I would like to convert that Column to ...
d_gosbell
7 years agoSuper User
There might be other ways of doing this, but used Table.AddColumns to add a column with a constant value of 1. Then I used Table.Group to group all the rows on that value and used Text.Combine to join that xmltaskids column.
eg.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wiik1MDBOLkkszvZMAbNTjSwMzQxNjA0gMvrIUkqxOlh1mJsbW1oamZCsw5RkHWYk6zAnQQc+n8cCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [xmltaskids = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"xmltaskids", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Group", each 1),
#"Grouped Rows" = Table.Group(#"Added Custom", {"Group"}, {{"TaskIds", each Text.Combine( [xmltaskids]), type text}}),
#"FirstRow" = #"Grouped Rows"{[Group=1]}[TaskIds],
body = Text.Combine({"<Envelope xmlns=""http://schemas.xmlsoap.org/soap/envelope/"">
<Body>
<readTasks xmlns=""http://mercury.com/ppm/pm/service/1.0"">", #"FirstRow",
"</readTasks>
</Body>
</Envelope> "})
in
body