Skip to content

Sort#

ใช้ Sort node เพื่อจัดเรียง (sort) รายการ item ตามลำดับที่ต้องการ หรือสุ่มเลือกข้อมูล

Array sort behavior

Sort operation จะใช้การ sort แบบ JavaScript ปกติ โดย element ที่จะ sort จะถูกแปลงเป็น string แล้วเปรียบเทียบกัน ดูรายละเอียดเพิ่มเติมได้ที่ Mozilla's guide to Array sort

Node parameters#

ตั้งค่า node นี้ด้วย parameter Type

เลือกวิธีการ sort ได้จาก dropdown ดังนี้

Simple#

จะทำการ sort แบบ ascending หรือ descending ตาม field ที่เลือก

เมื่อเลือก Type นี้:

  • ใช้ปุ่ม Add Field To Sort By เพื่อกรอก Field Name
  • เลือกว่าจะใช้ลำดับ Ascending หรือ Descending

Simple options#

เมื่อเลือก Simple เป็น Type จะมี option ให้ Disable Dot Notation โดยปกติ n8n จะเปิด dot notation เพื่ออ้างถึง child field ในรูปแบบ parent.child สามารถปิด option นี้ได้ (เปิด/ปิด)

Random#

สุ่มลำดับรายการใน list

Code#

ใส่ JavaScript code เองเพื่อ custom การ sort เหมาะสำหรับกรณีที่ sort แบบ simple ไม่เพียงพอ

กรอก JavaScript code ในช่อง Code

Templates and examples#

Automated Web Scraping: email a CSV, save to Google Sheets & Microsoft Excel

by Mihai Farcas

View template details
Transcribing Bank Statements To Markdown Using Gemini Vision AI

by Jimleuk

View template details
Allow Users to Send a Sequence of Messages to an AI Agent in Telegram

by Chris Carr

View template details
Browse Sort integration templates, or search all templates

เรียนรู้เพิ่มเติมเกี่ยวกับ data structure and data flow ใน n8n workflows