Table.ReorderColumns
Syntax
Table.ReorderColumns(table as table, columnOrder as list, optional missingField as nullable number) as table
About
Returns a table from the input table
, with the columns in the order specified by columnOrder
. Columns that are not specified in the list will not be reordered. If the column doesn't exist, an exception is thrown unless the optional parameter missingField
specifies an alternative (eg. MissingField.UseNull
or MissingField.Ignore
).
Example 1
Switch the order of the columns [Phone] and [Name] in the table.
Usage
Table.ReorderColumns(
Table.FromRecords({[CustomerID = 1, Phone = "123-4567", Name = "Bob"]}),
{"Name", "Phone"}
)
Output
Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]})
Example 2
Switch the order of the columns [Phone] and [Address] or use "MissingField.Ignore" in the table. It doesn't change the table because column [Address] doesn't exist.
Usage
Table.ReorderColumns(
Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]}),
{"Phone", "Address"},
MissingField.Ignore
)
Output
Table.FromRecords({[CustomerID = 1, Name = "Bob", Phone = "123-4567"]})
Phản hồi
https://aka.ms/ContentUserFeedback.
Sắp ra mắt: Trong năm 2024, chúng tôi sẽ dần gỡ bỏ Sự cố với GitHub dưới dạng cơ chế phản hồi cho nội dung và thay thế bằng hệ thống phản hồi mới. Để biết thêm thông tin, hãy xem:Gửi và xem ý kiến phản hồi dành cho