0
votes

I have a string column which includes "," delimiter, I want to split this column into multiple rows.

Here's the table

|Token          |Shop|
|a              |P   |
|A10,A9a,C1a,F1 |R   |

Expected Output:

|Token          |Shop|
|a              |P   |
|A10            |R   |
|A9a            |R   |
|C1a            |R   |
|F1             |R   |

I tried below logic using mv-expand but it doesn't seem to work

datatable(Tokens:string, Shop:string)["a", "P", 
"A10,A9a,C1a,F1", "R" ]
| mv-expand Token =todynamic(Tokens) to typeof(string)
1

1 Answers

4
votes

You can use split() before mv-expand:

datatable(Tokens:string, Shop:string)["a","P","A10,A9a,C1a,F1","R" ]
| mv-expand token = split(Tokens, ",") to typeof(string)