query.addColumn()
Adds a column to a query and populates its rows with the contents of an one-dimensional array.
Pads query columns, if necessary, to ensure that all columns have the same number of rows.
query.addColumn( column=string, datatype_or_array=any, array=any )
Returns: Query
Argument | Description |
---|---|
column
string,
required
|
Alias: columnName |
datatype_or_array
any,
optional
|
Alias: datatype |
array
any,
optional
|
Examples
myquery = querynew("id,name");
myquery.addrow();
myquery.setcell("id","1");
myquery.setcell("name","item1");
myquery.addRow();
myquery.setcell("id","2");
myquery.setcell("name","item2");
myquery.addColumn("age",listtoarray("20,21"));
myquery.addColumn("class",listtoarray("A,B"));
writeDump(myquery);