chwunder
chwunder

Reputation: 21

how to convert table columns to one new column

i´m having a table in Azure Data Explorer like this:

OperationsId name resultCode duration
1234 httprequest1234 200 79,3
5678 httprequest5678 200 11,5

I would like to now summarize now by OperationsID, but than having all remaining items which corresponds to this operationsID in a new column like this:

OperationsId Details
1234 {"name": "httprequest1234", "resultcode":200, "duration":79,3, ....}
5678 {"name": "httprequest5678", "resultcode":200, "duration":11,5, ....}

doesn´t have to be JSON, but is there a way to convert a table or multiple columns of a table to a new column?

Thanks

Upvotes: 0

Views: 51

Answers (1)

David דודו Markovitz
David דודו Markovitz

Reputation: 44941

datatable (OperationsId:long, name:string, resultCode:int, duration:real)
[
    1234 ,"httprequest1234" ,200 ,79.3
   ,5678 ,"httprequest5678" ,200 ,11.5
]
| project OperationsId, Details = bag_remove_keys(pack_all(), dynamic(["OperationsId"]))
OperationsId Details
1234 {"name":"httprequest1234","resultCode":200,"duration":79.3}
5678 {"name":"httprequest5678","resultCode":200,"duration":11.5}

Fiddle

Upvotes: 1

Related Questions