Marc Pincince
Marc Pincince

Reputation: 5202

Is there a way to replace all nulls in a table at once?

If I have a table like this:

enter image description here

How might I replace all nulls with blanks at once?

I'd prefer a solution that dynamically accounts for column names, to account for more or less columns and differing column names. So Table.ReplaceValue(#"Changed Type",null,"",Replacer.ReplaceValue,{"Column1", "Column2", "Column3", "Column4"}) would not be what I'm after.

I'm thinking the solution would rely on somehow using something like{Table.ColumnNames(tablename here)} in place of {"Column1", "Column2", "Column3", "Column4"}but when I try that, I get an error:

enter image description here

I'm sure I just don't understand the proper syntax. I'll certainly appreciate your help.

Upvotes: 1

Views: 2785

Answers (1)

Marc Pincince
Marc Pincince

Reputation: 5202

I think I just figured it out. I needed to drop the brackets. I changed...

Table.ReplaceValue(#"Added Custom",null,"",Replacer.ReplaceValue,{Table.ColumnNames(#"Changed Type")})

to...

Table.ReplaceValue(#"Added Custom",null,"",Replacer.ReplaceValue,Table.ColumnNames(#"Changed Type"))

and it seemed to work.

Upvotes: 3

Related Questions