共用方式為


Table.TransformRows

語法

Table.TransformRows(table as table, transform as function) as list

關於

list 作業套用至 transform 中的每個資料列,以建立 table

範例 1

將資料表的列轉換成數字清單。

使用方式

Table.TransformRows(
    Table.FromRecords({
        [a = 1],
        [a = 2],
        [a = 3],
        [a = 4],
        [a = 5]
    }),
    each [a]
)

輸出

{1, 2, 3, 4, 5}

範例 2

將數值資料表的列轉換成文字記錄。

使用方式

Table.TransformRows(
    Table.FromRecords({
        [a = 1],
        [a = 2],
        [a = 3],
        [a = 4],
        [a = 5]
    }),
    (row) as record => [B = Number.ToText(row[a])]
)

輸出

{
    [B = "1"],
    [B = "2"],
    [B = "3"],
    [B = "4"],
    [B = "5"]
}