You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

请求Dataverse表中Plant Type列的动态依赖公式

实现Dataverse Plants表动态关联Plant Type选项的方案

核心说明

公式列属于计算型列,仅能用于展示计算结果,无法作为可输入的选项列表控件的数据源。要实现数据库层面的数据完整性+动态选择Plant Type的需求,优先用Dataverse的依赖查找配置,或结合Power Apps表单的动态控件设置。


方案一:数据库层面(Dataverse原生配置)- 依赖查找列

这种方式直接在Dataverse中配置,从根源限制数据输入范围:

  1. 给Fruit和Vegetable表各添加一个Lookup列(比如命名为关联分类),关联到Categories表。确保所有Fruit记录的关联分类都指向Categories表中的"Fruit"记录,Vegetable记录的关联分类指向"Vegetable"记录。
  2. 在Plants表中创建Plant Type为多表Lookup列,允许关联Fruit和Vegetable表。
  3. 编辑Plant Type列的高级选项,设置过滤规则:
    • 当Plant Category等于Categories表的"Fruit"记录时,仅显示Fruit表中关联分类为"Fruit"的记录;
    • 当Plant Category等于"Vegetable"记录时,仅显示Vegetable表中关联分类为"Vegetable"的记录。

方案二:Power Apps表单中动态控制输入选项

如果需要在表单中实时切换选项列表,同时配合Dataverse的约束保障完整性:

  1. 在Plants表的编辑表单中,选中Plant Type对应的下拉控件,将其Items属性设置为以下公式(替换控件名和列名为你实际的名称):
If(
    DataCardValue_PlantCategory.Selected.Name = "Fruit",
    Fruit,
    DataCardValue_PlantCategory.Selected.Name = "Vegetable",
    Vegetable
)
  1. 数据库层面保障:在Plants表的Plant Type列设置为必填,并添加Dataverse业务规则:
    • 当Plant Category为"Fruit"时,校验Plant Type必须来自Fruit表;
    • 当Plant Category为"Vegetable"时,校验Plant Type必须来自Vegetable表。

补充:公式列(仅用于展示选项列表,不可输入)

如果只是需要在Plants表中用公式列展示对应分类的所有可选Plant Type名称,可使用以下公式(根据实际列名调整):

If(
    'Plant Category'.Name = "Fruit",
    Concat(FILTER(Fruit, '关联分类'.Name = "Fruit"), Name, ", "),
    'Plant Category'.Name = "Vegetable",
    Concat(FILTER(Vegetable, '关联分类'.Name = "Vegetable"), Name, ", ")
)

内容的提问来源于stack exchange,提问作者WASAP

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 21:32:48