QueryToStruct()

Copy the query columns data to struct by using the columnKey argument

Introduced: 6.0.0.302

QueryToStruct( query=query, columnKey=string, structType=string, valueRowNumber=boolean );

Returns: Struct

Argument Description Default
query
query, required

A query to copy to a struct

columnKey
string, required

Column name that values are used for struct key

Alias: column, columnName

structType
string, optional

default:ordered, Struct type to created

Alias: type

ordered

valueRowNumber
boolean, optional

default: false, the boolean value that indicates the struct values return as column data or row number

Alias: valueAsRowNumber

Examples

qry = query(
    id: [ 1, 2, 3, 4 ],
    name: [ "mssql", "mysql", "image", "pdf" ],
    version: [ "7.2.2.jre8", "8.0.30", "1.0.0.42", "1.1.0.7" ]
  );

basic = queryToStruct( qry, "name"); dump( var=basic, label="basic (ordered)");

normal = queryToStruct( qry, "version", "normal", false); dump( var=normal, label="normal (unordered)");

row = queryToStruct( qry, "version", "normal", true); dump( var=row, label="valueRowNumber=true,unordered");

member = qry.ToStruct("id"); dump(var=member, label="member");

See also