Record.RenameFields
Record.RenameFields(record as record, renames as list, optional missingField as nullable number) as record
将输入 record
中的字段重命名为列表 renames
中指定的新字段名称后,返回一个记录。对于多个重命名,可以使用嵌套的列表({ {old1, new1}, {old2, new2} })。
示例:
从记录将字段 "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]
示例:
从记录将字段 "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]