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

Power Apps画廊日期过滤报错求助:ThisItem未识别及Substitute参数无效

Power Apps 画廊过滤错误修复方案

错误原因分析

你遇到的两个核心问题:

  • ThisItem 未被识别:ThisItem 仅适用于画廊、表单等控件的内部模板上下文,Filter 函数直接操作数据源 tbl_TimeSaved,不能在其中使用 ThisItem,必须直接引用数据源的字段名。
  • Substitute 参数错误:公式中错误引用了 EmployeeNo 字段(你需要过滤的是 DateWorked),且直接对日期时间类型的字段使用 Substitute 容易因格式匹配问题失效。

正确过滤公式

根据你的需求(匹配 4/17/2023 格式的日期),分两种情况给出解决方案:

情况1:下拉框值为文本格式日期(如"4/17/2023")

If(
    !IsBlank(ReconcileWorkdateStartDate.Value),
    Filter(
        tbl_TimeSaved,
        Text(DateValue(DateWorked), "m/d/yyyy") = ReconcileWorkdateStartDate.Value
    ),
    tbl_TimeSaved // 下拉框为空时返回全部数据
)

用 DateValue 提取 DateWorked 的日期部分,再通过 Text 函数强制转换为 m/d/yyyy 格式,和下拉框的文本值精准匹配,比 Substitute 更可靠。

情况2:下拉框绑定的是日期类型值(而非文本)

如果下拉框是日期选择器或绑定日期字段,直接比较日期值即可:

If(
    !IsBlank(ReconcileWorkdateStartDate.SelectedDate),
    Filter(
        tbl_TimeSaved,
        DateValue(DateWorked) = ReconcileWorkdateStartDate.SelectedDate
    ),
    tbl_TimeSaved
)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.17 09:22:53