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

Power Query中List.Accumulate代码出现无效标识符错误求助

Power Query 替换值代码报错解决方法

错误原因

你代码里的 Replacements = [ 这一行用错了语法:在Power Query中,[] 是用来定义记录(Key-Value结构)的,而你这里的替换规则是一组有序的配对项,应该用 {} 来定义列表(List)。把列表语法写成记录语法,就会触发"invalid identifier"错误。

修正后的代码

Replacements = {
    {"1400", "Site Prep"}, {"1500", "Instrum & Telecom"}, {"1600", "Elec"}, {"1700", "Civil"},
    {"1800", "Structure"}, {"2000", "Bldg"}, {"2200", "Insulation"}, {"2300", "Painting"}
},
ReplacedValues = List.Accumulate(Replacements, RemovedColumns, (current, state) => 
    Table.ReplaceValue(current, state{0}, state{1}, Replacer.ReplaceText, {"Tag Discipline", "Discipline", "Phase", "Inspection state"})
),

额外验证点

  • 确保 RemovedColumns 是你之前步骤生成的有效表格对象,没有拼写错误或步骤缺失
  • 替换的列名 "Tag Discipline" 等要和你的表格列名完全匹配,注意大小写和空格

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 09:23:11