QueryNew

Return new query based on the provided column list, column types, and/or row data.

Available column types are:

  • bigint

  • binary

  • bit

  • date

  • decimal

  • double

  • integer

  • null

  • object

  • other

  • time

  • timestamp

  • varchar

If columnTypeList is empty, all columns will be of type "object".

Method Signature

Arguments

Argument
Type
Required
Description
Default

columnList

any

true

The column list to be used in the query, Ex: "name, age, dob". It can also be an array of structs that will be used as the row data.

columnTypeList

string

false

Comma-delimited list specifying column data types. If empty, all columns will be of type "object". Ex: "varchar, integer, date"

rowData

any

false

Data to populate the query. Can be a struct (with keys matching column names), an array of structs, or an array of arrays (in same order as columnList). Ex: [{name: "John", age: 30}, {name: "Jane", age: 25}]

Examples

Builds a simple query using queryNew

Using Script with the queryAddRow querySetCell functions to populate the query.

Run Example

Builds a simple query using queryNew

Using BL Tags with the queryAddRow querySetCell functions to populate the query.

Creating and Populating a query using an array rowData in queryNew

CF10+ Passes an array of structs to create a new query.

Run Example

Creating and Populating a single row query using rowData in queryNew

CF10+ If you only need one row you can pass a single struct instead of an array into the rowData argument.

Run Example

Creating and populating a query with an array of structs

CF2018u5+ Directly assigns columns and values with an array of structs.

Run Example

Additional Examples

Run Example

Last updated

Was this helpful?