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.

Reply
Anonymous
Not applicable

PBI Advanced editor "Apply" table: "We cannot convert a value of type Record to type List" error;

I'm a bit of a noobie to PBI; I have transformed my data in advanced editor and everything looks great; data is a list of records retrieved using web.contents() function.

 

Preview Table:

***************

ni1i2t1t2dcc_flat
000168337911616833791160[List]ISUZU D-MAX (BFS 921-M),BFS-921,Southern,LA,MFS
100168336119116833611910[List]Toyota Hilux (FAC 645),FAC-645,Southern,NY,BUSINESS SOLUTIONS

 

sample PBI query using web.contents():

******************************************

let
sessionID = Text.From(xyz),

prefix = URL,
Source = Json.Document(Web.Contents(prefix & sessionID)),
Flattened = List.Transform(Source, each Record.AddField(_, "c_flat", Text.Combine([c], ","))),
Result = Table.FromRecords(Flattened)
in
Result

 

data is transformed in advanced editor no problems; when i click "apply" to save preview to model; i get "We cannot convert a value of type Record to type List" error; I cannot for the life of me overcome is error.

 

When i load the data directly into script instead of pulling via web.contents() the data is transformed as expected and preview table can be "apply" saved to model

 

sample script without web.contents():

***************************************

let
Source = Json.Document("[{""n"":0,""i1"":0,""i2"":0,""t1"":1683379116,""t2"":1683379116,""d"":0,""c"":[""ISUZU D-MAX (BFS 921-M)"",""BFS-921"",""Southern"",""LA"",""MFS""]},{""n"":1,""i1"":0,""i2"":0,""t1"":1683361191,""t2"":1683361191,""d"":0,""c"":[""Toyota Hilux (FAC 645)"",""FAC-645"",""Southern"",""NY"",""BUSINESS SOLUTIONS""]}]"),
Flattened = List.Transform(Source, each Record.AddField(_, "c_flat", Text.Combine([c], ","))),
Result = Table.FromRecords(Flattened)
in
Result

 

sample json data:

*******************

[{"n":0,"i1":0,"i2":0,"t1":1683379116,"t2":1683379116,"d":0,"c":["ISUZU D-MAX (BFS 921-M)","BFS-921","Southern","LA","MFS"]},{"n":1,"i1":0,"i2":0,"t1":1683361191,"t2":1683361191,"d":0,"c":["Toyota Hilux (FAC 645)","FAC-645","Southern","NY","BUSINESS SOLUTIONS"]}]

 

I'm thinking the web.content() function has a limitation when handling a list of records. Any suggetions and work arounds would be greatly appreciated...cheers

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @Anonymous,

I copy your sample data and find these testing data can be correctly recognized and expanded these records in query editor side.

Can you please share some sample data with more complex records? They may cause the issue to recognize when your records nested different structures.

1.PNG

Notice: these query steps are recognized and auto generated by data connecting steps.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.