Condividi tramite


Table.FromRecords

Sintassi

Table.FromRecords(records as list, optional columns as any, optional missingField as nullable number) as table

Informazioni su

Converte l'elenco di record records in una tabella.

Esempio 1

Creare una tabella dai record, usando i numeri di campo dei record come nomi di colonna.

Utilizzo

Table.FromRecords({
    [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
    [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890"]
})

Output

Table.FromRecords({
    [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
    [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890"]
})

Esempio 2

Creare una tabella dai record con colonne tipizzate e selezionare le colonne numeriche.

Utilizzo

Table.ColumnsOfType(
    Table.FromRecords(
        {[CustomerID = 1, Name = "Bob"]},
        type table[CustomerID = Number.Type, Name = Text.Type]
    ),
    {type number}
)

Output

{"CustomerID"}

Campo mancante