Thep Excel

Record.AddFieldAdd a field to a Power Query record

Adds a new field with a specified name and value to a record | เพิ่มฟิลด์ใหม่พร้อมชื่อและค่าเข้าไปใน Record

fx
=Record.AddField(record, fieldName, value, [delayed]) as record

ความนิยม5/10
ความยาก4/10
ประโยชน์5/10

อัปเดต 4 December 2025

Syntax & Arguments

อาร์กิวเมนต์ ชนิด ค่าเริ่มต้น คำอธิบาย
record record The record object to be modified
fieldName text The name of the new field being added
value any The data value to assign to the field
[delayed]ไม่บังคับ nullable logical false Optional parameter; allows deferred evaluation when set to true

[ ] = อาร์กิวเมนต์ที่ไม่บังคับ

Additional Notes

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 ที่มีอยู่แล้ว โดยระบุชื่อฟิลด์และค่าที่ต้องการเพิ่ม เหมาะสำหรับการขยายโครงสร้างข้อมูลแบบไดนามิกในกระบวนการแปลงข้อมูล

Examples

Add a single field to a customer recordRecord.AddField([CustomerID = 1, Name = "Bob", Phone = "123-4567"], "Address", "123 Main St.")

Adds an Address field to an existing customer record while preserving all original fields

fx
=Record.AddField([CustomerID = 1, Name = "Bob", Phone = "123-4567"], "Address", "123 Main St.")

ผลลัพธ์[CustomerID = 1, Name = "Bob", Phone = "123-4567", Address = "123 Main St."]
Add multiple fields using nested Record.AddFieldlet Customer = [ID = 1, Name = "Alice"], WithEmail = Record.AddField(Customer, "Email", "alice@example.com"), WithCity = Record.AddField(WithEmail, "City", "New…

Chain multiple Record.AddField calls to progressively add new fields to a record

fx
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"]
Add a calculated field valuelet Item = [Price = 100, Quantity = 5], Total = Item[Price] * Item[Quantity], WithTotal = Record.AddField(Item, "Total", Total) in WithTotal

Add a field with a calculated value based on existing fields in the record

fx
let
Item = [Price = 100, Quantity = 5],
Total = Item[Price] * Item[Quantity],
WithTotal = Record.AddField(Item, "Total", Total)
in
WithTotal

ผลลัพธ์[Price = 100, Quantity = 5, Total = 500]

Resources & Related

ฟังก์ชันที่ผู้เขียนโยงไว้กับ Record.AddField จัดกลุ่มตามหมวด · ชี้ที่ชื่อใดชื่อหนึ่ง แล้วฟังก์ชันที่ใช้คู่กันจะมีจุดทอง

ฟังก์ชันนี้Record.AddFieldRecord functions
Record functions (5)
Record.Field

Record.Field ดึงค่าของฟิลด์ที่ระบุจากบันทึก (record) โดยใช้ชื่อฟิลด์เป็นข้อความ ต่างจาก Record.FieldOrDefault ตรงที่จะเกิดข้อผิดพลาดหากฟิลด์ไม่พบ

Record.FieldOrDefault

ดึงค่าจาก Record ถ้าไม่เจอให้คืนค่า Default

Record.RemoveFields

Removes specified fields from a record | ลบฟิลด์ที่ระบุออกจาก Record

Record.SelectFields

Record.SelectFields จะคืนค่า Record ใหม่ที่มีเฉพาะ Field ที่ระบุใน List เท่านั้น สามารถจัดการกับ Field ที่หายไปได้ด้วย option missingField

Record.TransformFields

Record.TransformFields แปลงค่าในฟิลด์ที่ระบุของเรคอร์ดโดยใช้ฟังก์ชันแปลงค่า สามารถแปลงฟิลด์เดียวหรือหลายฟิลด์พร้อมกันได้ เหมาะสำหรับการทำความสะอาดข้อมูลและการแปลงประเภทข้อมูล

Comments

อีเมลของคุณจะไม่ถูกเผยแพร่