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]