Pular para o conteúdo
officetuning.aiofficetuning.ai
TreinamentosConsultoriaBibliotecaFerramentasConteúdoPortfólio
Entrar
officetuning.aiofficetuning.ai

Treinamento, consultoria e mentoria para decidir, construir e aprender nas quatro frentes da marca.

AI · Data · Productivity · Dev · São Paulo
contato@officetuning.ai
TreinamentosPower BIExcelSQLPowerPointIA + ProdutividadeTodos os treinamentos
PortalConsultoriaBibliotecaPortfólioBackground BuilderDashboard CanvasConteúdo
InstitucionalPolítica de privacidadeInformações legais
© 2026 officetuning.ai · São Paulo
  1. Biblioteca
  2. Power Query (M)
  3. Funções M
  4. BinaryFormat.Choice

BinaryFormat.Choice

MBinário

Retorna um formato binário que escolhe o próximo formato com base em um valor já lido: binaryFormat lê o primeiro valor, chooseFunction o inspeciona e devolve um segundo formato, que lê o segundo valor. Se combineFunction for informada, ela recebe os dois valores e seu resultado é retornado; caso contrário, retorna o segundo valor.

Sintaxe

M
BinaryFormat.Choice(binaryFormat as function, chooseFunction as function, optional type as nullable type, optional combineFunction as nullable function) as function

Parâmetros

binaryFormatfunctionObrigatório

Formato binário usado para ler o primeiro valor.

M
BinaryFormat.Byte
chooseFunctionfunctionObrigatório

Função que recebe o primeiro valor e retorna o formato binário do segundo.

M
(length) => BinaryFormat.List(BinaryFormat.Byte, length)
typenullable typeOpcional

Tipo do formato retornado pela função de escolha (type any, type list ou type binary).

combineFunctionnullable functionOpcional

Função que combina o primeiro e o segundo valores no resultado final.

Retorna

function

Exemplo

M
let
    binaryData = #binary({2, 3, 4, 5}),
    listFormat = BinaryFormat.Choice(
        BinaryFormat.Byte,
        (length) => BinaryFormat.List(BinaryFormat.Byte, length)
    )
in
    listFormat(binaryData)

Resultado

M
{3, 4}

Observações

type aceita type any (padrão), type list ou type binary. Com type list ou type binary, o sistema pode retornar um valor em streaming em vez de em buffer, reduzindo o uso de memória.

Mais informações

Subgrupo
BinaryFormat
Referência
https://learn.microsoft.com/pt-br/powerquery-m/binaryformat-choice
Função anteriorBinaryFormat.ByteOrderPróxima função BinaryFormat.Decimal
Biblioteca