动态表参考 - 环境和替代方法

发布于 2025-02-08 21:28:12 字数 1453 浏览 2 评论 0原文

这是我问题在查询编辑器中可见的动态表数据,但数据视图中的空白

使用 expression.evaluate(文档,环境)我是设置环境
要么#Sections [Section1]

AddedTables = Table.AddColumn(Source, "Data", each Expression.Evaluate("shop_" & Text.From([shop]), #sections[Section1]))

#shared

AddedTables = Table.AddColumn(Source, "Data", each Expression.Evaluate("shop_" & Text.From([shop]), #shared))

但是工作解决方案似乎是在Environment中明确定义内部和外部上下文对象

AddedTables = Table.AddColumn(Source, "Data", each Expression.Evaluate("shop_" & Text.From([shop]), [shop_thehouse=shop_thehouse, shop_goldforex=shop_goldforex, shop_goldline=shop_goldline]))

因此,我的后续问题这里是2倍,

  1. 为什么在环境中使用#shared参数不起作用?
    毕竟,#shared包含所有对象,因此也由工作解决方案明确定义的对象(shop_thehouseshop_goldforex> shop_goldline)。
  2. 有其他或更好地引用现有表/查询的方法,而不是使用 expression.evaluate()

This is a follow-up to my question Dynamic table data visible in query editor but blank in data view.

While using Expression.Evaluate(document, environment) I was setting environment
either to #sections[Section1]

AddedTables = Table.AddColumn(Source, "Data", each Expression.Evaluate("shop_" & Text.From([shop]), #sections[Section1]))

or to #shared

AddedTables = Table.AddColumn(Source, "Data", each Expression.Evaluate("shop_" & Text.From([shop]), #shared))

but a working solution seems to be to explicitly define the inner and outer context objects in environment

AddedTables = Table.AddColumn(Source, "Data", each Expression.Evaluate("shop_" & Text.From([shop]), [shop_thehouse=shop_thehouse, shop_goldforex=shop_goldforex, shop_goldline=shop_goldline]))

So, my follow-up question here is 2-fold

  1. Why does using #shared in the environment parameter not work?
    After all, #shared contains all objects, so also the ones that were explicitly defined by the working solution (shop_thehouse,shop_goldforex,shop_goldline).
  2. Is there another or better way to dynamically reference an existing table/query, instead of using Expression.Evaluate() ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清欢 2025-02-15 21:28:12

我相信您的答案可以解释在这里

据我了解,#section从A global 的角度返回信息,而#shared将其从 local 返回看法。我 think ,也许在您的用法上下文中,商店名称在本地没有任何东西(使用#shared),因为您想要的是在其他表中。我认为您是一个全球用例,因为您正在从另一个桌子中寻找商店信息。希望有人比我能确认这一点更熟悉。

I believe your answer might be explained here.

As I understand it, #section returns information from a global perspective, whereas #shared returns it from a local perspective. I think, maybe, in your usage context, there is nothing for the shop names to find locally (using #shared) since what you're looking for is in other tables. I think that yours is a global use case since you're looking for shop information from another table. Hopefully someone more familiar than I can confirm this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文