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

Power Apps中Patch函数后添加Notify报错求助

解决Power Apps中Patch与Notify函数联用的语法错误

我在Power Apps的解决方案里做了一个保存按钮,用于保存所有Grid数据,编写的代码如下:

Patch(
Projects;
ShowColumns(
    colGridUpdates;
    "Title";
    "Bereich";
    "F_x00e4_lligkeitsdatum";
    "Ge_x00e4_ndert_x0020_am";
    "Auftraggeber";
    "Organisation";
    "ID"));Notify("Das Raster wurde erfolgreich gespeichert";NotificationType.Success;3000);Clear(colGridUpdates)

Patch函数单独运行正常,但添加Notify函数后出现语法错误:Patch函数后的分号标红提示无需保留,删除该分号后又出现“Operator expected(预期运算符)”错误。


问题原因与解决方案

从代码里用分号作为函数参数分隔符可以看出,你的Power Apps区域设置为德语系(这类区域中,单分号;是函数参数的分隔符,双分号;;才是多个函数连续执行的语句分隔符)。原来的代码用单分号分隔Patch、Notify和Clear函数,导致语法解析冲突,引发错误。

修正后的代码如下:

Patch(
    Projects;
    ShowColumns(
        colGridUpdates;
        "Title";
        "Bereich";
        "F_x00e4_lligkeitsdatum";
        "Ge_x00e4_ndert_x0020_am";
        "Auftraggeber";
        "Organisation";
        "ID"
    )
);;
Notify("Das Raster wurde erfolgreich gespeichert"; NotificationType.Success; 3000);;
Clear(colGridUpdates)

把原来分隔函数的单分号替换为双分号,即可让多个函数按顺序正常执行,同时消除语法错误。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.19 19:40:02