如何使用PowerQuery公式中的TextBoxinput?

我想使用PowerQuery公式,其中包括像文本框input

Json.Document(Web.Contents("https://thesite.com/api/widgets", [Query=[name=TextBoxName.Text]])) 

但是我得到这个错误

 Expression.Error: The import TextBoxName.Text matches no exports. Did you miss a module reference? 

如何在我的查询中使用TextBoxName.Text作为参数?

它是否必须是一个文本框? 把值放入一个Excel表中,然后调用这个表“Parameters”。

在这里输入图像说明

然后编写一个读取表中参数的函数。

 (ParameterName as text) => let ParamSource = Excel.CurrentWorkbook(){[Name="Parameters"]}[Content], ParamRow = Table.SelectRows(ParamSource, each ([Parameter] ParameterName)), Value= if Table.IsEmpty(ParamRow)=true then null else Record.Field(ParamRow{0},"Value") in Value 

赋予该函数名称fnGetParameter并加载它。

现在,您可以在另一个查询中使用此函数来获取表中任何参数的值,如下所示:

 let MyQuery = fnGetParameter("JSONQuery"), Source = Json.Document(Web.Contents("https://thesite.com/api/widgets", [Query=[name=MyQuery]])) 

值得一提的是,Ken Puls在他的博客中描述了这个技术,并且在他的书“M is for(Data)Monkey”中也有介绍。