Forum Discussion
olimilo
5 years agoPost Prodigy
Can I parameterize the Table.ReplaceValue command in a custom function?
I made the custom function below as I need to run the same function for 15+ columns, basically to replace colA with colB if it isn't null, otherwise to retain the value of colA: let updateFie...
LillyBeast
1 year agoFrequent Visitor
You would need to wrap that in an Evaluate.Expression to allow running text as M-Code. See this example
Also, Table.ReplaceValue is really just passing (in_value, look_for, replace_with) parameters to any function. You could write yours as:
Table.ReplaceValue(
table
, each _ColA
, each _ColB
, (value, old, new) => old ?? new
, {ColA}
)
The `??` operator is M-Code's null-coalesce