Zdieľať cez


Record.RenameFields

Syntax

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

Informácie

Vráti záznam po premenovaní polí vo vstupe record na nové názvy polí zadané v zozname renames. Pre viaceré premenovania možno použiť vnorený zoznam ({ {old1, new1}, {old2, new2} }.

Príklad č. 1

Premenujte pole UnitPrice na Price zo záznamu.

Použitie

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

Výkon

[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žitie

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

Výkon

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