Record.TransformFields

This function returns a modified record by applying specified transformations from a list called transformOperations. Transformation can be done on one or more fields at a time. When transforming a s...

Syntax

Record.TransformFields(record as record, transformOperations as list, optional missingField as nullable number) as record

About

This function returns a modified record by applying specified transformations from a list called transformOperations. Transformation can be done on one or more fields at a time. When transforming a single field, the transformOperations list should have two items. The first item indicates the field name, and the second item specifies the transformation function to be used. For instance, {"Quantity", Number.FromText} For transforming multiple fields, the transformOperations list should contain nested lists, where each inner list consists of a field name and the corresponding transformation operation. For example, {{"Quantity",Number.FromText},{"UnitPrice", Number.FromText}}.

Explanation

Convert the data in the "Price" field into numerical format. Usage: In Power Query M language, use the MRecord.TransformFields function to convert the "Price" field from text to number. Example: Input data: [OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = "100.0"] Code: MRecord.TransformFields( [OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = "100.0"], {"Price", Number.FromText}) Output: [OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100] --- Convert the data in the "OrderID" and "Price" fields into numerical format. Usage: In Power Query M language, use the MRecord.TransformFields function to convert the "OrderID" and "Price" fields from text to number. Example: Input data: [OrderID = "1", CustomerID = 1, Item = "Fishing rod", Price = "100.0"] Code: MRecord.TransformFields( [OrderID = "1", CustomerID = 1, Item = "Fishing rod", Price = "100.0"], {{"OrderID", Number.FromText}, {"Price", Number.FromText}}) Output: [OrderID = 1, CustomerID = 1, Item = "Fishing ro