Record.RenameFields

構文

Record.RenameFields(record as record, renames as list, optional missingField as nullable number) as record  

バージョン情報

入力 record 内のフィールドの名前を、リスト renames で指定された新しいフィールド名に変更したレコードが返されます。 複数の名前を変更する場合は、入れ子になったリスト ({ {old1, new1}, {old2, new2} }) を使用します。

例 1

レコードのフィールド "UnitPrice" の名前を "Price" に変更します。

使用方法

Record.RenameFields(
    [OrderID = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0],
    {"UnitPrice", "Price"}
)

出力

[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]

例 2

レコードのフィールド "UnitPrice" の名前を "Price" に変更し、"OrderNum" の名前を "OrderID" に変更します。

使用方法

Record.RenameFields(
    [OrderNum = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0],
    {
        {"UnitPrice", "Price"},
        {"OrderNum", "OrderID"}
    }
)

出力

[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]