Binary.View is a Power Query M function that returns a custom view of a binary value, allowing you to override the default behavior of certain operations. The function is useful for implementing folding in data sources and returns a view of the binary value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Binary.View(
binary as nullable binary,
handlers as record,
) as binary
Description
Returns a view of binary
where the functions specified in handlers
are used in lieu of the default behavior of an operation when the operation is applied to the view.
If binary
is provided, all handler functions are optional. If binary
isn’t provided, the GetStream
handler function is required. If a handler function isn’t specified for an operation, the default behavior of the operation is applied to binary
instead (except in the case of GetExpression
).
Handler functions must return a value that is semantically equivalent to the result of applying the operation against binary
(or the resulting view in the case of GetExpression
).
If a handler function raises an error, the default behavior of the operation is applied to the view.
Binary.View
can be used to implement folding to a data source – the translation of M queries into source-specific operations (for example, to download a section of a file).
Refer to the published Power Query custom connector documentation for a more complete description of Binary.View
.
Examples
Create a basic view that doesn’t require accessing the data in order to determine the length.
// Output: Text.ToBinary( "hello world!" )
Binary.View(
null,
[
GetLength = () => 12,
GetStream = () => Text.ToBinary( "hello world!" )
]
)
Related functions
Other functions related to Binary.View are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy