BinaryFormat.UnsignedInteger16
BinaryA binary format that reads a 16-bit unsigned integer.
Syntax
BinaryFormat.UnsignedInteger16(binary as binary) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
binary | binary | Yes | The binary data to read the 16-bit unsigned integer from. |
Return Value
function — A binary format function that reads a 2-byte unsigned integer from binary data.
Remarks
BinaryFormat.UnsignedInteger16 is a binary format specifier that reads a 16-bit (2-byte) unsigned integer from binary data. The value range is 0 to 65,535 (UInt16 / ushort).
The default byte order is little-endian (least significant byte first). Use BinaryFormat.ByteOrder to wrap this format if the source data uses big-endian byte ordering.
This format is commonly used for reading port numbers, character codes, small counts, and other unsigned 16-bit values from binary file formats and network protocols.
Examples
Example 1: Read a 16-bit unsigned integer
let
binaryData = #binary({0x00, 0x01}),
result = BinaryFormat.UnsignedInteger16(binaryData)
in
resultExample 2: Read two 16-bit unsigned integers in a record
let
binaryData = #binary({0x01, 0x00, 0xFF, 0x00}),
format = BinaryFormat.Record([
First = BinaryFormat.UnsignedInteger16,
Second = BinaryFormat.UnsignedInteger16
])
in
format(binaryData)Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks