Thep Excel

Table.Viewสร้าง View ของตาราง

สร้างหรือแก้ไขพฤติกรรมของตาราง สำหรับการพัฒนา Custom Connector และการจัดการ Query Folding

fx
=Table.View(view, handlers) as table

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

อัปเดต 6 December 2025

Syntax & Arguments

อาร์กิวเมนต์ ชนิด คำอธิบาย
view function ฟังก์ชัน View (มักปล่อยเป็น null หากไม่ต้องการ override)
handlers record Record ที่ระบุ Handlers ต่างๆ (เช่น GetType, GetRows, OnTake)

ฟังก์ชัน Table.View ใช้สำหรับสร้างหรือแก้ไขพฤติกรรมของตาราง (Handlers) มักใช้ในการพัฒนา Custom Connector หรือการจัดการ Query Folding (การส่ง Query กลับไปประมวลผลที่แหล่งข้อมูล) เป็นฟังก์ชันขั้นสูงสำหรับการจัดการ Data Source

How it works

Custom Connector Development

Custom Connector Development

Implementing DirectQuery

Implementing DirectQuery

Examples

Override Table Type (กำหนดประเภทข้อมูล)let MyType = type table [ID = number, Name = text], View = Table.View(null, [ GetType = () => MyType, GetRows = () => #table(MyType, {{1, "A"}, {2, "B"}}) ]) in…

สร้างตารางเสมือนโดยกำหนด Type และข้อมูลผ่าน Handler `GetType` และ `GetRows` เพื่อให้ Power Query รู้จักโครงสร้าง

fx
let
MyType = type table [ID = number, Name = text],
View = Table.View(null, [
GetType = () => MyType,
GetRows = () => #table(MyType, {{1, "A"}, {2, "B"}})
])
in
View

ผลลัพธ์Table (ID, Name) with Defined Type
Implement Query Folding (OnTake)let View = Table.View(null, [ GetType = () => type table [ID = number], GetRows = () => …, OnTake = (count) => … // Logic to push Take (Top N) to data sourc…

ตัวอย่างโครงสร้าง (Concept) การใช้ `OnTake` เพื่อรองรับการส่งคำสั่ง `Top N` ไปยัง Data Source (Query Folding)

fx
let
View = Table.View(null, [
GetType = () => type table [ID = number],
GetRows = () => …,
OnTake = (count) => … // Logic to push Take (Top N) to data source
])
in
View

ผลลัพธ์Table View with Folding Support
จัดการ Error Handling (OnInvoke)let View = Table.View(null, [ GetRows = () => …, OnInvoke = (function, args) => … // Custom logic ]) in View

ใช้ `OnInvoke` เพื่อดักจับและจัดการการเรียกใช้ฟังก์ชันต่างๆ กับตารางนี้ ป้องกันการเกิด Error ที่ไม่คาดคิด

fx
let
View = Table.View(null, [
GetRows = () => …,
OnInvoke = (function, args) => … // Custom logic
])
in
View

ผลลัพธ์Table View

Resources & Related

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

ฟังก์ชันนี้Table.ViewTable functions
Table functions (3)
Table.FromRecords

แปลง List ของ Record เป็นตาราง โดยแต่ละ Record กลายเป็นหนึ่งแถว เหมาะสำหรับข้อมูลจาก API หรือ JSON

Table.FromRows

Table.FromRows สร้างตารางจาก List ของ List โดยแต่ละ List ย่อยแทนข้อมูลในแถวหนึ่ง คล้ายกับการ transpose ข้อมูลแบบแถว-คอลัมน์ แต่ทำให้เป็นตารางจริงในทันที

Table.ViewError

สร้าง Error สำหรับ Table.View Handlers

Comments

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