在使用Power Query M语言从REST API响应中创建3列的表格时,我遇到了问题。
下面是我的代码(最后,我的表'newTable'仍然为空
let
Source = Json.Document(Web.Contents("https://admcorpdev.service-now.com/api/now/stats/incident?sysparm_query=active%3Dtrue%5EpriorityIN1%2C2&sysparm_count=true&sysparm_group_by=caller_id.location.u_region%2Cpriority")),
result = Table.FromRecords(Source[result]),
newTable = #table(
{
"Priority",
"Region",
"Count"
},
{}
),
TableSource = Table.Buffer(result),
data = List.Generate(
() => [x=0],
each [x]<= Table.RowCount(result),
each [
//Generate a new Table and append fields into it
newTable = Table.InsertRows(newTable,1,{[Priority = "2", Region ="NA",Count = "56"]}),
x=[x]+1]
)
in
newTable