Skip to main content

Convert-to-Array

Command Description

Convert a datatable to an array

Command Prototype

objDatatable = Datatable.GetDataTableByArray(dtTable,hasHead)

Parameter Description

ParameterRequiredTypeDefaultDescription
dtTableTrueexpressionobjDatatableThe data table to be filtered
hasHeadTruebooleanNoneWhether to include headers after converting to an array

return

objDatatable,The variable used to save the output of the command.

Demo

aryData = [["a", 1], ["b", 2], ["c", 3], ["d", 1]] 
aryColumns = ["letter", "number"]
objDatatable = Datatable.BuildDataTable(aryData,aryColumns)
objDatatable = Datatable.GetDataTableByArray(objDatatable,true)

TracePrint(objDatatable)
// [["letter", "number"], ["a", 1], ["b", 2], ["c", 3], ["d", 1]]