Thep Excel

List.ConformToPageReader – แปลง List ของ Record เป็น Table สำหรับ Page Reader

แปลง List Record เป็น Table สำหรับ Internal Page Reader

List.ConformToPageReader ใช้ภายในเพื่อแปลง List ของ Record เป็น Table ตาม Schema ที่กำหนด เหมาะสำหรับโครงสร้างข้อมูลที่ Page Reader ต้องการ

=List.ConformToPageReader(list as list, schemaFunction as function) as table

By ThepExcel AI Agent
3 December 2025

Syntax & Arguments

=List.ConformToPageReader(list as list, schemaFunction as function) as table

Argument Type Required Default Description
list list Yes List ของ Record ที่แต่ละ Record เป็น 1 แถวของข้อมูล แต่ละ Record ควรมี Field ที่สอดคล้องกัน
schemaFunction function Yes ฟังก์ชันที่คืนค่า Record อธิบาย Schema ของ Table ผลลัพธ์ (ชื่อ Field และ Type)

How it works

การใช้ภายในโดย Power BI

ฟังก์ชันนี้ถูกใช้โดย Power BI เองเมื่อมีการแสดงข้อมูลจาก List ของ Record ในรายงานที่ต้องการโครงสร้างแบบ Table ที่ชัดเจน

การเตรียมข้อมูลสำหรับ Output เฉพาะ

หากมีการพัฒนา Custom Connector หรือส่วนเสริมที่ต้องการส่งข้อมูลในรูปแบบเฉพาะที่ Page Reader ต้องการ (ซึ่งไม่แนะนำให้ใช้ทั่วไป)

Examples

ตัวอย่างการแปลง List ของ Record เป็น Table

ฟังก์ชันนี้แปลง 'SalesData' ซึ่งเป็น List ของ Record ให้เป็น Table ที่มีโครงสร้างตามที่ 'SchemaFunction' กำหนด โดยแต่ละ Record ใน List จะกลายเป็นหนึ่งแถวใน Table
Power Query Formula:

let
    SalesData = 
    {
        [Product = "Product A", Region = "North", SalesAmount = 1000],
        [Product = "Product A", Region = "South", SalesAmount = 2000],
        [Product = "Product B", Region = "North", SalesAmount = 1500],
        [Product = "Product B", Region = "South", SalesAmount = 2500]
    },
    SchemaFunction = () => type table
    (
        [
            Product = text,
            Region = text,
            SalesAmount = number
        ]
    ),
    SalesTable = List.ConformToPageReader(SalesData, SchemaFunction)
in
    SalesTable

Result:

#table({'Product', 'Region', 'SalesAmount'}, {{'Product A', 'North', 1000}, {'Product A', 'South', 2000}, {'Product B', 'North', 1500}, {'Product B', 'South', 2500}})

FAQs

ควรใช้ List.ConformToPageReader ในโค้ด M ของเราโดยตรงหรือไม่?

ไม่แนะนำ เนื่องจากเป็นฟังก์ชันที่ออกแบบมาเพื่อใช้ภายใน Power BI หรือเครื่องมืออื่นๆ เพื่อจัดการกับโครงสร้างข้อมูลภายใน การเรียกใช้โดยตรงอาจไม่ให้ผลลัพธ์ที่คาดหวังหรือไม่เสถียร

มีฟังก์ชันใดที่ใช้แปลง List เป็น Table ที่แนะนำสำหรับการใช้งานทั่วไปบ้าง?

ควรใช้ฟังก์ชันอย่าง Table.FromList หรือ Table.FromRecords ซึ่งออกแบบมาสำหรับการแปลงข้อมูลอย่างชัดเจนและยืดหยุ่นกว่า

Resources & Related

Additional Notes

ฟังก์ชัน List.ConformToPageReader ใน Power Query เป็นฟังก์ชันที่ มีไว้ใช้ภายในเท่านั้น (internal use only) ซึ่งหมายความว่าโดยปกติแล้วผู้ใช้งานทั่วไปจะไม่เรียกใช้ฟังก์ชันนี้โดยตรง แต่จะถูกใช้โดย Power BI หรือเครื่องมืออื่นๆ เพื่อแปลง List ของ Record ให้เป็นโครงสร้าง Table ที่เหมาะสมสำหรับการแสดงผลในรายงาน Page Reader โดยต้องระบุ Schema ของ Table ที่ต้องการ

Leave a Reply

Your email address will not be published. Required fields are marked *