Powerquery遍历步骤列表
我正在使用excel powerquery从elasticsearch中提取数据。 对于一个结果它工作得很好,但我想要得到很多。 从最初的ES查询中,我得到了一个json对象列表,我可以很容易地将它转换为表格。 问题是,查询编辑器只能让我select一个结果在另一个之后,而不是parsing列表中的所有内容。
查询是:
let Content = "{""query"": {""match_all"": {}}}", Source = Json.Document(Web.Contents("http://es_host:9200/lcm_db/_search"))[hits][hits], Source1 = Source{1}, _source = Source1[_source], #"Converted to Table" = Record.ToTable(_source), #"Transposed Table" = Table.Transpose(#"Converted to Table") in #"Transposed Table" Json.Document(Web.Contents("http://es_host:9200/lcm_db/_search"))[hits][hits]
给我一个清单,我必须做4个步骤:
Source1 = Source{1}, _source = Source1[_source], #"Converted to Table" = Record.ToTable(_source), #"Transposed Table" = Table.Transpose(#"Converted to Table")
我将如何进行权力查找所有列表结果的这四个步骤?
谢谢,艾萨克
您可以使用List.Transform,并将这4个步骤包含在let语句中。 它看起来像这样:
= List.Transform(Json.Document(Web.Contents(“http:// es_host:9200 / lcm_db / _search”))[hits] [hits],(value)=> each 让 _source = value [_source], #“转换为表”= Record.ToTable(_source), #“Transposed Table”= Table.Transpose(#“Converted to Table”) 在 #“转置表”)