动态表参考 - 环境和替代方法
这是我问题在查询编辑器中可见的动态表数据,但数据视图中的空白。
使用 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倍,
- 为什么在
环境中使用
参数不起作用?#shared
毕竟,#shared
包含所有对象,因此也由工作解决方案明确定义的对象(shop_thehouse
,shop_goldforex
,> shop_goldline
)。 - 有其他或更好地引用现有表/查询的方法,而不是使用 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
- Why does using
#shared
in theenvironment
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
). - Is there another or better way to dynamically reference an existing table/query, instead of using Expression.Evaluate() ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您的答案可以解释在这里。
据我了解,
#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.