Type.ForRecord

Sintassi

Type.ForRecord(fields as record, open as logical) as type

Informazioni su

Restituisce un tipo che rappresenta i record con vincoli specifici per il tipo nei campi.

Esempio 1

Generare dinamicamente un tipo di tabella.

Utilizzo

let
    columnNames = {"Name", "Score"},
    columnTypes = {type text, type number},
    rowColumnTypes = List.Transform(columnTypes, (t) => [Type = t, Optional = false]),
    rowType = Type.ForRecord(Record.FromList(rowColumnTypes, columnNames), false)
in
    #table(type table rowType, {{"Betty", 90.3}, {"Carl", 89.5}})

Output

#table(
    type table [Name = text, Score = number],
    {{"Betty", 90.3}, {"Carl", 89.5}}
)