Type.IsOpenRecord
TypeReturns true if the given record type is open — meaning it allows fields beyond those declared in the type.
Syntax
Type.IsOpenRecord(type as type) as logicalParameters
| Name | Type | Required | Description |
|---|---|---|---|
type | type | Yes | The record type to test. Must be a type that is a record type. |
Return Value
logical — True if the record type is open, false if it is closed.
Remarks
Type.IsOpenRecord tests whether a record type is open or closed. In Power Query M's type system, record types can be either:
- Open: the value may have additional fields beyond those declared in the type. The base type record is open by default.
- Closed: the value must have exactly the declared fields — no more, no fewer undeclared fields are permitted.
Type.IsOpenRecord returns true for open record types and false for closed ones. Use this function before calling Type.OpenRecord or Type.ClosedRecord to avoid unnecessary conversions, or to branch logic based on whether a schema is fully specified.
A practical note: Type.ForRecord with isOpen = false (or omitted) creates a closed type. With isOpen = true it creates an open type. The base type record written as a literal is always open.
Use Type.OpenRecord and Type.ClosedRecord to convert between open and closed record types.
Examples
Example 2: A closed record type returns false
Type.IsOpenRecord(Type.ClosedRecord(type record))Result | |
|---|---|
| 1 | FALSE |
Example 3: Type.ForRecord is closed by default (isOpen = false)
let
RT = Type.ForRecord([Name = [Type = type text, Optional = false]], false)
in
Type.IsOpenRecord(RT)Result | |
|---|---|
| 1 | FALSE |