Table of contents
TOC
Collapse the table of content
Expand the table of content

Table.TransformColumns

Owen Duncan|Last Updated: 10/5/2018
|
1 Contributor

About

Transforms columns from a table using a function.

Table.TransformColumns(table as table, transformOperations as list, optional defaultTransformation as nullable function, optional missingField as nullable number) as table  

Arguments

ArgumentDescription
tableThe Table to modify.
transformOperationsThe list of transformOperations to run.
optional defaultTransformationThe default table transformation.
optional missingFieldMissing field value.

Remarks

  • Table.TransformColumns is similar to Record.TransformFields applied to every row in a table.

Examples

Table.TransformColumns(      
Table.FromRecords({[A="1", B=2], [A="5", B=10]}),      
{"A", Number.FromText})   
equals  Table.FromRecords({[A=1,B=2], [A=5,B=10]})  
Table.TransformColumns(     
Table.FromRecords({[A="1",B=2], [A="5", B=10]}),      
{{"A", Number.FromText},       
{"B", each _ + 1}})   
equals  Table.FromRecords({[A=1,B=3], [A=5,B=11]})  
Table.TransformColumns(      
Table.FromRecords({[A="1",B=2], [A="5", B=10]}),      
{"X", Number.FromText})   
equals  Expression.Error  
Table.TransformColumns(      
Table.FromRecords({[A="1",B=2], [A="5", B=10]}),      
{"X", Number.FromText},      
MissingField.Ignore)   
equals  Table.FromRecords({[A="1",B=2], [A="5",B=10]})  
Table.TransformColumns(      
Table.FromRecords({[A="1",B=2], [A="5", B=10]}),      
{"X", Number.FromText},      
MissingField.UseNull)   
equals  Table.FromRecords({[A="1",B=2,X=/* Expression.Error*/],   
[A="5",B=10,X=/* Expression.Error error*/]})  
© 2018 Microsoft