List.accumulate 无效标识符

问题描述 投票:0回答:1

我正在使用强力查询来替换表中的值

    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"})
),

我在 =[ 之后遇到无效标识符错误 最后:

我不确定发生了什么,也找不到任何信息。 谢谢四位的支持 N.

from the editor from the main window

powerquery identifier
1个回答
0
投票

尝试用此方法替换所有列中记录列表中的值:

let  Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Tag Discipline", type text}, {"Discipline", type text}, {"Phase", type text}, {"Inspection state", type text}, {"Column1", type text}}),
Replacements = [1400="Site Prep", 1500="Instrum & Telecom", 1600="Elec", 1700="Civil",1800="Structure",2000="Bldg",2200="Insulation",2300="Painting"],
Replace=Table.ReplaceValue(#"Changed Type",Replacements,"something",(x,y,z)=>try Record.FieldOrDefault(y,x,x) otherwise null,  Table.ColumnNames(#"Changed Type"))
in Replace

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.