Power Query 和 Odata.Feed “如何向源查询添加参数?”

huangapple go评论95阅读模式
英文:

Power Query & Odata.Feed "How can i add a Parameter to source query?"

问题

我正在通过Odata.Feed创建一个Power Query连接,需要插入一个参数(DateTimeZone.LocalNow)。

OData.Feed("https://test.test?$filter=Test eq '1969' and WhseTaskConfWhseTmznDate ge datetime'2023-06-28T10:20:00'&$select=Activity", null, [Implementation="2.0"])

我想要包括一个参数,以便只获取今天的数据,而不是所有数据。

有没有办法设置参数并将其包含到源代码中?

英文:

I am creating a Power Query connection via Odata.Feed and i need to insert a parameter (DateTimeZone.LocalNow).

OData.Feed("https://test.test?$filter=Test eq '1969' and WhseTaskConfWhseTmznDate  ge datetime'2023-06-28T10:20:00'&$select=Activity", null, [Implementation="2.0"])

I would like to include a parameter so that i just get the today's Data and not all.

Any Idea how to set the Parameter and include it to the source code?

答案1

得分: 0

以下是翻译好的部分:

如何

     x = OData.Feed("https://test.test?$filter=Test eq '1969' and WhseTaskConfWhseTmznDate ge datetime'
       "&DateTime.ToText(DateTime.LocalNow(), [Format="yyyy-MM-ddTHH:mm:ss", Culture="en-US"])&"
      '&$select=Activity", null, [Implementation="2.0"])

编辑

选择不是今天的日期,例如前一天

    Date.AddDays(DateTime.LocalNow(),-1)

或使用变量

    Date.AddDays(DateTime.LocalNow(),VariableDays)

其中您在之前的步骤中定义了该名称为

    VariableDays= Excel.CurrentWorkbook(){[Name="rangenamehere"]}[Content]{0}[Column1],

并在包含您要提取的数字的Excel文件中设置了名为**rangenamehere**的已定义范围名称
英文:

How about

 x = OData.Feed("https://test.test?$filter=Test eq '1969' and WhseTaskConfWhseTmznDate ge datetime'
   "&DateTime.ToText(DateTime.LocalNow(), [Format="yyyy-MM-ddTHH:mm:ss", Culture="en-US"])&"
  '&$select=Activity", null, [Implementation="2.0"])

EDIT

to pick up a date that is not today, for example one day back

Date.AddDays(DateTime.LocalNow(),-1)

or use a variable

Date.AddDays(DateTime.LocalNow(),VariableDays)

where you define that name in an earlier step as

VariableDays= Excel.CurrentWorkbook(){[Name="rangenamehere"]}[Content]{0}[Column1],

and have set up a defined range name caleld rangenamehere in the excel file that contains a number you will pull in

huangapple
  • 本文由 发表于 2023年7月10日 23:33:07
  • 转载请务必保留本文链接:https://go.coder-hub.com/76655265.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定