Record.FromTable
RecordConverts a two-column table (Name, Value) into a record, using the Name column as field names and Value as field values.
Syntax
Record.FromTable(table as table) as recordParameters
| Name | Type | Required | Description |
|---|---|---|---|
table | table | Yes | A table with exactly two columns named "Name" (text) and "Value" (any). Each row becomes a field in the result record. |
Return Value
record — A record constructed from the Name-Value pairs in the table.
Remarks
Record.FromTable is the inverse of Record.ToTable. It converts a two-column table with Name and Value columns into a record, where each row contributes one field: the Name column value becomes the field name and the Value column value becomes the field value.
The input table must have exactly two columns named Name (text) and Value (any). Field names must be unique — duplicate Name values raise an error. The resulting record preserves the row order of the input table as the field order.
This function is most useful when you have key-value data in tabular form — such as configuration tables, parameter tables, or pivoted data — and you need to operate on it as a record. A common pattern is to read a two-column settings table from a data source and convert it to a record for use in subsequent query steps.
Examples
Example 1: Convert a Name-Value table to a record
Record.FromTable(
#table({"Name", "Value"}, {{"CustomerID", 1}, {"FullName", "Alice"}, {"City", "New York"}})
)CustomerID | FullName | City | |
|---|---|---|---|
| 1 | 1 | Alice | New York |
Example 2: Round-trip a record through ToTable and back — verifies lossless conversion
let
Original = [A = 1, B = "hello", C = true],
AsTable = Record.ToTable(Original),
BackToRecord = Record.FromTable(AsTable)
in
BackToRecord[B]The final output — accesses the B field of the restored record, returning the text value "hello".
Result | |
|---|---|
| 1 | hello |
Example 3: Build a summary record from Sales table statistics
let
Pairs = #table({"Name", "Value"}, {
{"TotalOrders", Table.RowCount(Sales)},
{"FirstOrderID", Sales{0}[OrderID]},
{"LastOrderID", Sales{Table.RowCount(Sales) - 1}[OrderID]}
}),
Summary = Record.FromTable(Pairs)
in
Record.ToTable(Summary)The final output — converts the summary record back to a two-column Name/Value table for display.
Name | Value | |
|---|---|---|
| 1 | TotalOrders | 5 |
| 2 | FirstOrderID | 1 |
| 3 | LastOrderID | 5 |