Цитата:
Сообщение от
mazzy
Вместо такой тягомотной конструкции лучше писать
X++:
SysQuery::findOrCreateRange(this.query().dataSourceTable(tablenum(InventLocation)),fieldNum(InventLocation, InventLocationId));
Для DAX 4.0 используя Global::findOrCreateRange_W можно пойти еще дальше в направлении компактного написания кода и тогда
X++:
qbr = this.query().dataSourceNo(1).findRange(fieldNum(InventLocation, InventLocationId));
if (! qbr )
qbr = this.query().dataSourceNo(1).addRange(fieldNum(InventLocation, InventLocationId));
qbr.value(queryValue("ля-ля-ля"));
//qbr.status(RangeStatus::Locked);
будет выгдядеть как:
X++:
...
findOrCreateRange_W( this.query().dataSourceTable(tablenum(InventLocation)),
fieldNum(InventLocation, InventLocationId),
queryValue("ля-ля-ля") ).status(RangeStatus::Locked);
...