---
title: Record.ReorderFields – จัดลำดับ Field
url: https://www.thepexcel.com/functions/power-query/record-functions/record-reorderfields/
type: function-explainer
program: Power Query
syntax: "Record.ReorderFields(record as record, fieldOrder as list, optional missingField as nullable number) as record"
date: 2025-12-03
updated: 2025-12-17
scores:
  popularity: 4
  difficulty: 4
  usefulness: 4
---

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

> Reorder fields in a record | จัดเรียงลำดับฟิลด์ใน Record อย่างยืดหยุ่น

## คำอธิบาย

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

## Syntax

```excel
Record.ReorderFields(record as record, fieldOrder as list, optional missingField as nullable number) as record
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| record | Yes | record |  | The record containing the fields to reorder |
| fieldOrder | Yes | list |  | List defining the new field sequence; unlisted fields maintain their original positions |
| missingField | No | nullable number | null | Optional parameter for handling missing fields |

## เคสการใช้งาน

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

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

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

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

### Join ตาราง

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

## ตัวอย่าง

### 1. Basic field reordering

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

**ผลลัพธ์:** `[OrderID = 1, CustomerID = 1, Item = "Fishing rod", Price = 100.0]`

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

### 2. Reorder specific fields

```excel
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]`

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

### 3. Prepare data for export

```excel
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]`

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

## คำถามที่พบบ่อย

**Q: Comparer.OrdinalIgnoreCase ต่างจาก Comparer.Ordinal อย่างไร?**

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

## ฟังก์ชันที่เกี่ยวข้อง

- [Record.SelectFields – เลือก Field ที่ต้องการจาก Record](https://www.thepexcel.com/functions/power-query/record-functions/record-selectfields/)
- [Record.RemoveFields – Remove fields from a record](https://www.thepexcel.com/functions/power-query/record-functions/record-removefields/)
- [Table.ReorderColumns – จัดเรียงลำดับคอลัมน์ใหม่](https://www.thepexcel.com/functions/power-query/table-functions/table-reordercolumns/)

## แหล่งข้อมูลเพิ่มเติม

- [Microsoft Learn: Record.ReorderFields](https://learn.microsoft.com/en-us/powerquery-m/record-reorderfields) _(official)_
- [PowerQuery.how](https://powerquery.how/record-reorderfields/) _(guide)_

---

_Source: [https://www.thepexcel.com/functions/power-query/record-functions/record-reorderfields/](https://www.thepexcel.com/functions/power-query/record-functions/record-reorderfields/)_
