List.Type

Updated on

List.Type is a type facet in the Power Query M language. It represents the default type claim for the ‘type list’. It is used primarily for handling collections of values in data processing and manipulation within Power Query M. The base type of ‘type list’ in Power Query is for arrays or collections and defines the characteristics of these collections.

Examples

Generally, you will face a facet when transforming column types. You can transform a column into the specified type by using Table.TransformColumnTypes:

Table.TransformColumnTypes( Source, {{ "myColumn", List.Type }} )

Or when adding a column using Table.AddColumn:

Table.AddColumn( Source, "myColumn", { 1, 2, 3 }, List.Type" )

To inspect the kind of value you are dealing with, you can make use of the Table.Schema function. Applying it to a table returns a table with information about your columns. The Table.SingleRow function then transforms the result into a record, for easier reading.

let 
  a =  { 1, 2, 3 },
   // Ascribes the default type claim facet for 'type list'
  b = Value.ReplaceType( a, List.Type ),
  // Returns a table containing a value with the ascribed "List.Type" 
  c = #table(type table [Col1 = Value.Type( b ) ], { b } ), 
  // Shows the Table information, including typeName and value kind
  d = Table.Schema( c ),
  // For easier viewing, return table as record
  e = Table.SingleRow( d )
in 
  e

Related facets

Other related facets are:

Contribute » | Contributors: Rick de Groot

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy