OpenBI Docs Buy

Record.RemoveFields

A record without the fields you name.

Group: Record. Power Query M has it too: a query that uses it is written as in Power BI.

Syntax

Record.RemoveFields(record as record, fields as any, optional missingField as nullable number) as record
ParameterTypeDescription
recordrecordThe record to work on.
fieldsanyA field name, or a list of them.
missingFieldnullable number
optional
What to do with a field name the record doesn't have: MissingField.Error (the default), MissingField.Ignore (skip it) or MissingField.UseNull (add it as a field of null).

Returns

record. The record with the other fields, in their order.

Examples

Without a note

Record.RemoveFields([Order = 1001, Shop = "Oslo", Note = "gift"], "Note")
[Order = 1001, Shop = "Oslo"]

A field that may be missing

Record.RemoveFields([Order = 1001, Shop = "Oslo"], "Discount", MissingField.Ignore)
[Order = 1001, Shop = "Oslo"]

Missing, without MissingField

Record.RemoveFields([Order = 1001, Shop = "Oslo"], "Discount")

Result: an error.

[Reason = "Expression.Error", Message = "The field 'Discount' of the record wasn't found.", Detail = null]

Record.SelectFields, Record.AddField, Table.RemoveColumns.

Last updated · OpenBI Studio 0.3.79