Record.RenameFields

Syntax

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

O

Vráti záznam po premenovaní polí vo vstupnom record na nové názvy polí zadané v zozname renames. Pre viacnásobné premenovanie je možné použiť vnorený zoznam ({ {old1, new1}, {old2, new2} }).

Príklad č. 1

Premenujte pole UnitPrice na Price zo záznamu.

používania

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

výstupu

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

Príklad č. 2

Premenujte pole UnitPrice na Price a pole OrderNum na OrderID zo záznamu.

používania

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

výstupu

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