enum name and value to the label

When you have name of the enum and you know integer of the value that you want to display.

dictEnum dictEnum;

dictEnum = new DictEnum(enumName2Id(“NoYes”));
info( strFmt(“%1”, dictEnum.index2Label(1)));

Advertisements

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(dictTable.id(), fieldId);

if(dictField.arraySize() > 1)
{
continue;
}

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

}
}
info( output);
}