The Table.ColumnNames function and its practical use
The Table.ColumnNames functions provides names of columns from some table. The only argument is the name of the table.
So for exammple here, from the Pricelist table:
It creates this list of names of columns:
How to use it practically?
If you joined the Pricelist table to some other table:
and then extracted columns, the M syntax will be, by default, like this:
Whats wrong? If some column in attached table was renamed (deleted, added...), the extraction would generate errors.
But the Table.ColumnName enables us to declare something like "extract all columns, that the attached table has just now".
- = Table.ExpandTableColumn(Source,
Table.ColumnNames only appears two times. Once it declares, which columns are going to be extracted, and then defines their names.