Record.FieldNames

Record

Returns a list of field names from a record.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Record.FieldNames(record as record) as list

Parameters

NameTypeRequiredDescription
recordrecordYesThe record whose field names to return.

Return Value

listA list of text values representing the field names.

Remarks

Record.FieldNames returns the field names of a record as a list of text values. The names are returned in the same order they appear in the record. This is useful for inspecting the structure of a record or dynamically iterating over its fields. To access a single row as a record from a table, use the table{index} syntax — for example, Sales{0} returns the first row as a record.

Examples

Example 1: Get field names from the first Sales row

let
    FirstRow = Sales{0},
    Names = Record.FieldNames(FirstRow)
in
    #table({"FieldName"}, List.Transform(Names, each {_}))
Result
FieldName
1OrderID
2CustomerName
3Product
4Category
5UnitPrice
6Quantity
7OrderDate
8Region

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks