Record.ToTable
RecordConverts a record into a two-column table with columns Name and Value.
Syntax
Record.ToTable(record as record) as tableParameters
| Name | Type | Required | Description |
|---|---|---|---|
record | record | Yes | The record to convert to a table. |
Return Value
table — A table with two columns — Name (text) and Value (any) — one row per field.
Remarks
Record.ToTable converts a record into a two-column table with columns Name (text) and Value (any). Each field in the record becomes one row. Row order matches the field order in the record.
This is the inverse of Record.FromTable. Common uses include:
- Inspection: displaying all fields of a record in a structured table view
- Finding nulls: filtering the resulting table for rows where [Value] = null
- Dynamic field iteration: applying Table.SelectRows, Table.AddColumn, or other table operations across all fields without knowing them by name
The Value column has type any because records can contain fields of mixed types. After converting to a table, you can filter, sort, or transform by field name using standard table functions.
Examples
Example 1: Convert a record to a two-column Name/Value table
Record.ToTable([Name = "Alice", Age = 30, City = "New York"])Name | Value | |
|---|---|---|
| 1 | Name | Alice |
| 2 | Age | 30 |
| 3 | City | New York |
Example 2: Inspect all fields of the first Sales row
Record.ToTable(Sales{0})Name | Value | |
|---|---|---|
| 1 | OrderID | 1 |
| 2 | CustomerName | Alice |
| 3 | Product | Widget A |
| 4 | Category | Widgets |
| 5 | UnitPrice | 25 |
| 6 | Quantity | 4 |
| 7 | OrderDate | 2024-01-15 |
| 8 | Region | East |
Example 3: Find which fields in a record contain null values
let
Row = [OrderID = 1, CustomerName = null, Product = "Widget A", Notes = null],
AsTable = Record.ToTable(Row),
NullFields = Table.SelectRows(AsTable, each [Value] = null)
in
NullFieldsThe final output — a table listing only the fields from the record that contain null values.
Name | Value | |
|---|---|---|
| 1 | CustomerName | null |
| 2 | Notes | null |