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]