Adds a new field with a specified name and value to a record | เพิ่มฟิลด์ใหม่พร้อมชื่อและค่าเข้าไปใน Record
=Record.AddField(record as record, fieldName as text, value as any, optional delayed as nullable logical) as record
=Record.AddField(record as record, fieldName as text, value as any, optional delayed as nullable logical) as record
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
| record | record | Yes | The record object to be modified | |
| fieldName | text | Yes | The name of the new field being added | |
| value | any | Yes | The data value to assign to the field | |
| delayed | nullable logical | Optional | false | Optional parameter; allows deferred evaluation when set to true |
Record.AddField([CustomerID = 1, Name = "Bob", Phone = "123-4567"], "Address", "123 Main St.")=Record.AddField([CustomerID = 1, Name = "Bob", Phone = "123-4567"], "Address", "123 Main St.")
[CustomerID = 1, Name = "Bob", Phone = "123-4567", Address = "123 Main St."]
let Customer = [ID = 1, Name = "Alice"], WithEmail = Record.AddField(Customer, "Email", "alice@example.com"), WithCity = Record.AddField(WithEmail, "City", "New…let
Customer = [ID = 1, Name = "Alice"],
WithEmail = Record.AddField(Customer, "Email", "alice@example.com"),
WithCity = Record.AddField(WithEmail, "City", "New York")
in
WithCity
[ID = 1, Name = "Alice", Email = "alice@example.com", City = "New York"]
let Item = [Price = 100, Quantity = 5], Total = Item[Price] * Item[Quantity], WithTotal = Record.AddField(Item, "Total", Total) in WithTotallet
Item = [Price = 100, Quantity = 5],
Total = Item[Price] * Item[Quantity],
WithTotal = Record.AddField(Item, "Total", Total)
in
WithTotal
[Price = 100, Quantity = 5, Total = 500]
Record.AddField adds a new field to an existing Power Query record with a specified name and value. This function is essential for dynamically extending records during data transformation workflows.
ฟังก์ชัน Record.AddField ใช้สำหรับเพิ่มฟิลด์ใหม่เข้าไปใน Record ที่มีอยู่แล้ว โดยระบุชื่อฟิลด์และค่าที่ต้องการเพิ่ม เหมาะสำหรับการขยายโครงสร้างข้อมูลแบบไดนามิกในกระบวนการแปลงข้อมูล