Returns a record after renaming specified fields | เปลี่ยนชื่อฟิลด์ที่ระบุใน Record
=Record.RenameFields(record as record, renames as list, optional missingField as nullable number) as record
=Record.RenameFields(record as record, renames as list, optional missingField as nullable number) as record
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
| record | record | Yes | The input record to modify | |
| renames | list | Yes | List of rename pairs where each pair is {OldName, NewName}. For a single rename use {{“OldName”, “NewName”}}, for multiple use {{{“Old1”, “New1”}, {“Old2”, “New2”}}} | |
| missingField | nullable number | Optional | null | Optional parameter for handling missing fields |
Record.RenameFields([OrderID = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 100.0], {{"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]
Record.RenameFields([OrderNum = 1, CustomerID = 1, Item = "Fishing rod", UnitPrice = 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]
let RawData = [Col1 = "John", Col2 = 30, Col3 = "USA"], StandardField = Record.RenameFields(RawData, {{{"Col1", "FirstName"}, {"Col2", "Age"}, {"Col3", "Country…let
RawData = [Col1 = "John", Col2 = 30, Col3 = "USA"],
StandardField = Record.RenameFields(RawData, {{{"Col1", "FirstName"}, {"Col2", "Age"}, {"Col3", "Country"}}})
in
StandardField
[FirstName = "John", Age = 30, Country = "USA"]
Record.RenameFields renames one or more fields in a Power Query record. Provide a list of rename pairs where each pair contains the old field name and the new field name. You can perform multiple renames in a single operation.
ฟังก์ชัน Record.RenameFields ใช้สำหรับเปลี่ยนชื่อฟิลด์หนึ่งหรือหลายฟิลด์ใน Record โดยระบุคู่การเปลี่ยนชื่อที่มีชื่อเก่าและชื่อใหม่ สามารถเปลี่ยนชื่อหลายฟิลด์พร้อมกันได้ในคำสั่งเดียว เหมาะสำหรับการปรับชื่อฟิลด์ให้เป็นมาตรฐานหรือเข้าใจง่ายขึ้น