generating CSV record with labels out of table fields

So pretty much this is the way to generate a line of csv file, getting value of the query table daa soucre field label values.

QueryRun qR;
Query _query;
Common record;

DictTable dictTable;
FieldId fieldId;
DictField dictField;

str output =””;
int x,y;

_query = new Query(“<nameOfTheQuery>”);
qR = new QueryRun(_query);
for(x = 1; x <= _query.dataSourceCount(); x++)

dictTable = new DictTable(_query.dataSourceNo(x).table());
for(y = 1; y <= _query.dataSourceNo(x).fields().fieldCount(); y++)
fieldId = _query.dataSourceNo(x).fields().field(y);
dictField = new DictField(, fieldId);

if(dictField.arraySize() > 1)

output += strFmt(“%1%2”, dictField.label(), “|”);

info( output);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s