Thep Excel

Record.ReorderFieldsจัดลำดับ Field

Rearranges the order of fields in a record | จัดเรียงลำดับฟิลด์ใหม่ใน Record ตามที่ต้องการ

fx
=Record.ReorderFields(record, fieldOrder, [missingField]) as record

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

อัปเดต 3 December 2025

Syntax & Arguments

อาร์กิวเมนต์ ชนิด ค่าเริ่มต้น คำอธิบาย
record record The record containing the fields to reorder
fieldOrder list List defining the new field sequence; unlisted fields maintain their original positions
[missingField]ไม่บังคับ nullable number null Optional parameter for handling missing fields

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

Additional Notes

Record.ReorderFields rearranges the order of fields in a Power Query record according to a specified sequence. Fields not listed in the new order maintain their original positions.

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

How it works

ค้นหาข้อความแบบ Case Insensitive

ใช้กับ List.Contains หรือ Text.Contains เพื่อให้หาเจอไม่ว่าจะพิมพ์เล็กหรือใหญ่

ลบค่าซ้ำแบบ Case Insensitive

ใช้กับ Table.Distinct หรือ List.Distinct เพื่อมองว่า "Apple" กับ "apple" คือค่าซ้ำกัน

Join ตาราง

ใช้ในการ Merge Queries เพื่อให้ Key ที่เป็นตัวพิมพ์ต่างกันสามารถจับคู่กันได้

Examples

Basic field reorderingRecord.ReorderFields([CustomerID = 1, OrderID = 1, Item = "Fishing rod", Price = 100.0], {"OrderID", "CustomerID"})

Moves OrderID and CustomerID to the front; Item and Price stay at the end

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

ผลลัพธ์[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]
Reorder specific fieldslet Data = [First = "John", Last = "Smith", Age = 30, Email = "john@example.com"], Reordered = Record.ReorderFields(Data, {"Email", "First", "Last"}) in Reorder…

Reorganizes fields to prioritize email; Age stays at the end since it wasn't mentioned

fx
let
Data = [First = "John", Last = "Smith", Age = 30, Email = "john@example.com"],
Reordered = Record.ReorderFields(Data, {"Email", "First", "Last"})
in
Reordered

ผลลัพธ์[Email = "john@example.com", First = "John", Last = "Smith", Age = 30]
Prepare data for exportRecord.ReorderFields([SKU = "ABC", Description = "Widget", Cost = 25, Retail = 49.99, InStock = true], {"SKU", "Description", "Retail"})

Reorder fields to match required export format while keeping remaining fields in original order

fx
=Record.ReorderFields([SKU = "ABC", Description = "Widget", Cost = 25, Retail = 49.99, InStock = true], {"SKU", "Description", "Retail"})

ผลลัพธ์[SKU = "ABC", Description = "Widget", Retail = 49.99, Cost = 25, InStock = true]

FAQs

Comparer.OrdinalIgnoreCase ต่างจาก Comparer.Ordinal อย่างไร?+

Comparer.Ordinal สนใจตัวพิมพ์เล็ก/ใหญ่ (Case Sensitive) ดังนั้น "A" ไม่เท่ากับ "a" ส่วน Comparer.OrdinalIgnoreCase ไม่สนใจ (Case Insensitive)

Resources & Related

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

ฟังก์ชันนี้Record.ReorderFieldsRecord functions
Record functions (3)
Record.RemoveFields

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

Record.SelectFields

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

Record.TransformFields

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

Comments

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