Value.RemoveMetadata
ValueReturns a copy of a value with all metadata removed, or with specified metadata fields removed.
Syntax
Value.RemoveMetadata(value as any, optional metadataRecord as nullable record) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
value | any | Yes | The value whose metadata is removed. |
metadataRecord | record | No | An optional record specifying which metadata fields to remove. If omitted, all metadata is removed. |
Return Value
any — The value with metadata removed.
Remarks
Value.RemoveMetadata strips the metadata record from a value, returning the value with no (or fewer) metadata fields. There are two modes:
- Without the optional parameter: removes all metadata — the result has an empty metadata record
- With a metadataRecord parameter: removes only the metadata fields whose names appear as fields in the provided record; other metadata fields are retained
The underlying data value is not changed — only the attached metadata record is modified. This is the destructive counterpart to Value.ReplaceMetadata.
Common use cases include:
- Cleaning values before output: stripping internal engine annotations before returning values to end users or downstream systems - Selective metadata removal: keeping useful annotations (e.g., display names) while removing internal bookkeeping fields - Testing: verifying that a value after an operation carries no unexpected metadata
Note that most M operations already discard metadata automatically. Value.RemoveMetadata is only needed when you have explicitly attached metadata and want to explicitly remove it, or when you receive a value from a connector that carries metadata you want to strip.
Examples
Example 1: Remove all metadata from a value
let
Annotated = 42 meta [Source = "Raw", Verified = false],
Clean = Value.RemoveMetadata(Annotated)
in
Value.Metadata(Clean)The final output — retrieves the metadata from the cleaned value, returning an empty record (no rows) confirming all metadata was removed.
Name | Value |
|---|
Example 2: The underlying value is preserved after removing metadata
let
Annotated = 42 meta [Source = "Raw"],
Clean = Value.RemoveMetadata(Annotated)
in
CleanThe final output — returns the cleaned value directly, showing that the number 42 is intact after metadata removal.
Result | |
|---|---|
| 1 | 42 |
Example 3: Verify that stripped value equals the unwrapped literal
let
Annotated = "hello" meta [Tag = "test"],
Stripped = Value.RemoveMetadata(Annotated)
in
Value.Equals(Stripped, "hello")The final output — checks that the stripped value is equal to the plain literal "hello", returning true to confirm the underlying value is unchanged.
Result | |
|---|---|
| 1 | TRUE |