Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Python script split table by end of lines (\n)

I have following issue trying run python script:

This is json to read:

{
  "startAt": 0,
  "maxResults": 5000,
  "maxResultsLimit": 5000,
  "total": 409,
  "values": [
    {
      "Id": "some-code-12321",
      "title": "Some Title",
      "some messages": [
        "something\nsomething",
        "something\nsomething"
      ],
     }
			]
}

This is Query:

let
    Source = Json.Document(File.Contents("path_to_json")),
    #"Converted to Table" = Record.ToTable(Source),
    Value = #"Converted to Table"{4}[Value],
    #"Converted to Table1" = Table.FromList(Value, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column2" = Table.ExpandRecordColumn(#"Converted to Table1", "Column1", {"Id", "title", "some messages"}, {"Id", "title", "some messages"}),
    #"Extracted Values1" = Table.TransformColumns(#"Expanded Column2", {"some messages", each try Text.Combine(List.Transform(_, Text.From), " ") otherwise _, type text}),
    #"Run Python script" = Python.Execute("# 'dataset' holds the input data for this script#(lf)",[dataset=#"Extracted Values1"]),
    dataset = #"Run Python script"{[Name="dataset"]}[Value]
in
    dataset

And here is output:

image.png

Of course output should looks like input, because python script didn't do anything so something is wrong.

Status: Accepted
Comments
v-qiuyu-msft
Community Support

Hi @Anonymous, 

 

I have reported this issue internally: CRI 153737976. Will update here once I get any information. 

 

Best Regards,
Qiuyun Yu 

v-qiuyu-msft
Community Support
Status changed to: Accepted
 
v-qiuyu-msft
Community Support

Hi @Anonymous, 

 

I got information that "The fix will be shipped with upcoming releases of PBI DesktopAs a mitigation, if customer also has , or " character inside the string, it won't be split anymore. "

 

Best Regards,
Qiuyun Yu

 

Anonymous
Not applicable

Thank You for Your support. Do You know when exactly the fix will be shipped?

v-qiuyu-msft
Community Support

Hi @Anonymous, 

 

It should be coming with November Power BI desktop.

 

Best Regards,
Qiuyun Yu

v-diye-msft
Community Support

Hi all,

 

The issue has been fixed. please kindly check.

 

Best Regards,
Dina Ye