ROOM64 / KNOWLEDGE / N8N

การใช้งาน Edit Fields (Set)

Edit Fields (Set) — เอกสารประกอบสำหรับ node แก้ไขฟิลด์ใน n8n ซึ่งเป็นแพลตฟอร์มอัตโนมัติของ workflow รวมถึงคำแนะนำในการใช้งาน และลิงก์ไปยังตัวอย่าง

อ่านต้นฉบับที่ n8n Official Docs ↗
คำแปลอัตโนมัติภาษาไทย แปลด้วย Google Translate / M2M100 จากเอกสาร n8n ณ วันที่ 2026-09-28 ยังไม่ได้ตรวจทานทางเทคนิคทุกหน้า โค้ดและ expression คงตามต้นฉบับ ชื่อ node เมนู และศัพท์เทคนิคคงภาษาอังกฤษเพื่อเทียบกับหน้าจอ n8n

Core nodes · จัดการข้อมูลและลำดับงาน · Edit Fields (Set)

← Core nodes

สารบัญในหน้านี้

เอกสารประกอบสำหรับ node แก้ไขฟิลด์ใน n8n ซึ่งเป็นแพลตฟอร์มอัตโนมัติของ workflow รวมถึงคำแนะนำในการใช้งาน และลิงก์ไปยังตัวอย่าง

ใช้ node แก้ไขฟิลด์เพื่อตั้งค่าข้อมูล workflow node นี้สามารถตั้งค่าข้อมูลใหม่รวมทั้งเขียนทับข้อมูลที่มีอยู่แล้วได้ node นี้มีความสำคัญอย่างยิ่งในขั้นตอนการทำงานที่คาดหวังข้อมูลขาเข้าจาก node ก่อนหน้า เช่น เมื่อแทรกค่าลงใน Google ชีตหรือฐานข้อมูล

parameter node

นี่คือการตั้งค่าและตัวเลือกที่มีอยู่ใน node แก้ไขฟิลด์

Mode

คุณสามารถใช้ Manual Mapping เพื่อแก้ไขฟิลด์โดยใช้ GUI หรือ JSON Output เพื่อเขียน JSON ที่ n8n เพิ่มลงในข้อมูล input

Fields to Set

หากคุณเลือก Mode > Manual Mapping คุณสามารถกำหนดค่าฟิลด์ได้โดยการลากและวางค่าจาก INPUT.

ลักษณะการทำงานเริ่มต้นเมื่อคุณลากค่าคือ:

  • n8n ตั้งชื่อค่าเป็นชื่อฟิลด์
  • ค่าของฟิลด์ประกอบด้วย expression ที่เข้าถึงค่า

หากคุณไม่ต้องการใช้ expression:

  1. โฮเวอร์เหนือฟิลด์ n8n แสดงไฟล์ แก้ไข | expression (Fixed | Expressions) สลับ
  2. เลือก Fixed.

คุณสามารถทำได้ทั้งกับชื่อและค่าของฟิลด์

ฟิลด์ที่ถูกลากจาก INPUT ลงในฟิลด์เพื่อตั้งค่า จากนั้นค่าของฟิลด์จะถูกสลับจาก expression เป็นคงที่

Keep Only Set Fields

เปิดใช้งานสิ่งนี้เพื่อละทิ้งข้อมูล input ที่คุณไม่ได้ใช้ Fields to Set.

Include in Output

เลือกข้อมูล input ที่จะรวมไว้ในข้อมูล output ของ node

ตัวเลือก node

ใช้ตัวเลือกเหล่านี้เพื่อปรับแต่งลักษณะการทำงานของ node

Include Binary Data

หากข้อมูลที่ป้อนมีข้อมูลไบนารี ให้เลือกว่าจะรวมไว้ในข้อมูล output ของ node แก้ไขฟิลด์หรือไม่

Ignore Type Conversion Errors

การทำแผนที่ด้วยตนเองเท่านั้น

การเปิดใช้งานนี้ทำให้ n8n สามารถละเว้นข้อผิดพลาดประเภทข้อมูลบางอย่างเมื่อทำการแมปฟิลด์

Support Dot Notation

ตามค่าเริ่มต้น n8n รองรับสัญลักษณ์จุด

ตัวอย่างเช่น เมื่อใช้การแมปด้วยตนเอง node จะเป็นไปตามสัญลักษณ์จุดสำหรับ Name สนาม นั่นหมายความว่าถ้าคุณตั้งชื่อใน Name สนามเป็น number.one และคุณค่าใน Value สนามเป็น 20 JSON ผลลัพธ์คือ:

{ "number": { "one": 20} }

คุณสามารถป้องกันพฤติกรรมนี้ได้โดยการเลือก Add Option > Support Dot Notation และการตั้งค่า Dot Notion สนามที่จะปิด ตอนนี้ JSON ผลลัพธ์คือ:

{ "number.one": 20 }

เทมเพลตและตัวอย่าง

เรียกดูเทมเพลตการรวมแก้ไขฟิลด์ (ชุด) หรือ ค้นหาเทมเพลตทั้งหมด

array และ expression ในโหมด output JSON

คุณสามารถใช้ array และ expression เมื่อสร้าง output JSON ของคุณได้

ตัวอย่างเช่น เมื่อได้รับข้อมูล input นี้ที่สร้างโดย node Customer Datastore:

[
  {
    "id": "23423532",
    "name": "Jay Gatsby",
    "email": "gatsby@west-egg.com",
    "notes": "Keeps asking about a green light??",
    "country": "US",
    "created": "1925-04-10"
  },
  {
    "id": "23423533",
    "name": "José Arcadio Buendía",
    "email": "jab@macondo.co",
    "notes": "Lots of people named after him. Very confusing",
    "country": "CO",
    "created": "1967-05-05"
  },
  {
    "id": "23423534",
    "name": "Max Sendak",
    "email": "info@in-and-out-of-weeks.org",
    "notes": "Keeps rolling his terrible eyes",
    "country": "US",
    "created": "1963-04-09"
  },
  {
    "id": "23423535",
    "name": "Zaphod Beeblebrox",
    "email": "captain@heartofgold.com",
    "notes": "Felt like I was talking to more than one person",
    "country": null,
    "created": "1979-10-12"
  },
  {
    "id": "23423536",
    "name": "Edmund Pevensie",
    "email": "edmund@narnia.gov",
    "notes": "Passionate sailor",
    "country": "UK",
    "created": "1950-10-16"
  }
]

เพิ่ม JSON ต่อไปนี้ใน JSON Output สนามด้วย Include in Output ตั้งค่าเป็น All Input Fields:

{
  "newKey": "new value",
  "array": [{{ $json.id }},"{{ $json.name }}"],
  "object": {
    "innerKey1": "new value",
    "innerKey2": "{{ $json.id }}",
    "innerKey3": "{{ $json.name }}",
 }
}

คุณได้รับผลลัพธ์นี้:

[
  {
    "id": "23423532",
    "name": "Jay Gatsby",
    "email": "gatsby@west-egg.com",
    "notes": "Keeps asking about a green light??",
    "country": "US",
    "created": "1925-04-10",
    "newKey": "new value",
    "array": [
      23423532,
      "Jay Gatsby"
    ],
    "object": {
      "innerKey1": "new value",
      "innerKey2": "23423532",
      "innerKey3": "Jay Gatsby"
    }
  },
  {
    "id": "23423533",
    "name": "José Arcadio Buendía",
    "email": "jab@macondo.co",
    "notes": "Lots of people named after him. Very confusing",
    "country": "CO",
    "created": "1967-05-05",
    "newKey": "new value",
    "array": [
      23423533,
      "José Arcadio Buendía"
    ],
    "object": {
      "innerKey1": "new value",
      "innerKey2": "23423533",
      "innerKey3": "José Arcadio Buendía"
    }
  },
  {
    "id": "23423534",
    "name": "Max Sendak",
    "email": "info@in-and-out-of-weeks.org",
    "notes": "Keeps rolling his terrible eyes",
    "country": "US",
    "created": "1963-04-09",
    "newKey": "new value",
    "array": [
      23423534,
      "Max Sendak"
    ],
    "object": {
      "innerKey1": "new value",
      "innerKey2": "23423534",
      "innerKey3": "Max Sendak"
    }
  },
  {
    "id": "23423535",
    "name": "Zaphod Beeblebrox",
    "email": "captain@heartofgold.com",
    "notes": "Felt like I was talking to more than one person",
    "country": null,
    "created": "1979-10-12",
    "newKey": "new value",
    "array": [
      23423535,
      "Zaphod Beeblebrox"
    ],
    "object": {
      "innerKey1": "new value",
      "innerKey2": "23423535",
      "innerKey3": "Zaphod Beeblebrox"
    }
  },
  {
    "id": "23423536",
    "name": "Edmund Pevensie",
    "email": "edmund@narnia.gov",
    "notes": "Passionate sailor",
    "country": "UK",
    "created": "1950-10-16",
    "newKey": "new value",
    "array": [
      23423536,
      "Edmund Pevensie"
    ],
    "object": {
      "innerKey1": "new value",
      "innerKey2": "23423536",
      "innerKey3": "Edmund Pevensie"
    }
  }
]
เอกสารและภาพต้นฉบับ © n8n GmbH · คำแปล คู่มือประกอบ และภาพแนวคิดเพิ่มเติมโดย Room64 · เว็บไซต์นี้ไม่ใช่เอกสารทางการของ n8n · Apache 2.0 พร้อม Commons Clause

มีงานที่อยากให้ Software, AI หรือ Automation ช่วยอยู่ไหม?

เล่า workflow หรือปัญหาที่ทีมกำลังเจอ เราช่วยดูได้ว่าควรใช้ระบบสำเร็จรูป เชื่อมเครื่องมือเดิม หรือพัฒนาเพิ่มเฉพาะส่วนไหน

คุยกับเราทาง LINEhello@room64.net