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.
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:
***************
n | i1 | i2 | t1 | t2 | d | c | c_flat |
0 | 0 | 0 | 1683379116 | 1683379116 | 0 | [List] | ISUZU D-MAX (BFS 921-M),BFS-921,Southern,LA,MFS |
1 | 0 | 0 | 1683361191 | 1683361191 | 0 | [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
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.
Notice: these query steps are recognized and auto generated by data connecting steps.
Regards,
Xiaoxin Sheng
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |