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);


Update help property if label exists

If you really need to copy existing label property to another property for example help text (that isn’t really best practice , I know 😦  ) this code can be used.

static void KindaBestPractiseThingy(Args _args)
TreeNode fields = TreeNode::findNode(@”\Data Dictionary\Tables\<TableName>\Fields”);
TreeNodeIterator fieldsIterator;
TreeNode field;
str label;

fieldsIterator = fields.AOTiterator();
field =;
Label = field.AOTgetProperty(#PropertyLabel);
Field.AOTsetProperty(#PropertyHelpText, Label);
field =;