Нужно именно dimension[8], имя в таблицах одно и то же. Удалось получать данное поле и заполнять переменную, однако в таблице значение не проставляется, что здесь может быть неправильно.
X++:
void clicked()
{
str strTableName;
tableid id;
str s;
LedgerTrans LedgerTrans;
Common tmpTable;
Query query;
QueryRun qr;
QueryBuildDataSource qbd;
QueryBuildRange qbr;
QueryRun queryrun_ ;
Common qres, myanytype;
N_FindVoucher N_FindVoucher;
int64 recId;
str strRecid;
fieldId fieldid,accnameid;
anyType ret,accname;
DictTable dt;
DictField dictField;
//N_FindVoucher sFindVoucher;
Dictionary dictionary;
tableName tableName;
VendTable VendTable;
//enum type;
;
breakpoint;
//получим вставляемые данные
Select firstonly VendTable
WHERE VendTable.AccountNum == "ПСчП002642";
if (VendTable.AccountNum)
{
while Select sFindVoucher
{
query = new Query();
// получим id таблицы
//id = tableName2Id(strTableName);
//передадим id в запрос
id = sFindVoucher.RefTableId;
qbd = query.addDataSource(id);
qbd.update(true);
//strRecid = "Recid";
recId = fieldname2id(id, 'RecId');
qbr = qbd.addRange(recId);
qbr.value(int642Str(sFindVoucher.RefRecId));
QueryRun_ = new QueryRun(query);
// QueryRun.prompt();
while(queryrun_.next())
{
//qres = typeId2ExtendedTypeId(qres);
qres = queryrun_.get(id);
if (qres != null)
{
fieldid = fieldName2Id(id,"dimension[8]");
ret = qres.(fieldid);
accnameid = fieldName2Id(id,"accountnum");
accname = qres.(accnameid);
if (ret == "" && accname == "91.2.2.02" || accname == "91.2.2.01")
{
if (qres.validateWrite())
{
ttsbegin;
ret = VendTable.AccountNum;
qres.update();
ttscommit;
}
}
}
}
}
}
}