![]() |
#11 |
Участник
|
Всем спасибо за помощь, вроде разобрался.
Сделал несколько функций: X++: str strPropertyGet(str _property) { str ret; ComVariant varOut = new ComVariant(ComVariantInOut::Out_retVal,ComVariantType::VT_BSTR); ComDispFunction _propertyGet = new COMDispFunction(Choose, _property, COMDispContext::PropertyGet); ; ret = (_propertyGet.call(varOut) ? "" : varOut.bStr()); varOut.finalize(); _propertyGet.finalize(); return strLTrim(strRTrim(ret)); } int intPropertyGet(str _property) { int ret; ComVariant varOut = new ComVariant(ComVariantInOut::Out_retVal,ComVariantType::VT_I4); ComDispFunction _propertyGet = new COMDispFunction(Choose, _property, COMDispContext::PropertyGet); ; ret = (_propertyGet.call(varOut) ? 0 : varOut.int()); varOut.finalize(); _propertyGet.finalize(); return ret; } date datePropertyGet(str _property) { date ret; ComVariant varOut = new ComVariant(ComVariantInOut::Out_retVal,ComVariantType::VT_DATE); ComDispFunction _propertyGet = new COMDispFunction(Choose, _property, COMDispContext::PropertyGet); ; ret = (_propertyGet.call(varOut) ? dateNull() : varOut.date()); varOut.finalize(); _propertyGet.finalize(); return ret; } X++: emplId = strPropertyGet("Код"); select forupdate firstonly firstfast emplTable where emplTable.EmplId == emplId; select forupdate firstonly firstfast companyImage where companyImage.RefRecId == emplTable.RecId; retVal = new ComVariant(ComVariantInOut::Out_retVal, ComVariantType::VT_DISPATCH); propertyGet = new COMDispFunction(Choose, "Хранилище", COMDispContext::PropertyGet); propertyGet.call(retVal); if (retVal.variantType() != ComVariantType::VT_NULL) { pic = Choose.(); // ХранилищеДополнительнойИнформации.Хранилище как Хранилище kart = con.NewObject("Картинка"); kart = pic.(); kart.("C:\\tmp.jpg"); binData = new BinData(); binData.loadFile("C:\\tmp.jpg"); cont = binData.getData(); companyImage.RefTableId = 103; companyImage.RefRecId = emplTable.RecId; companyImage.HasImage = NoYes::Yes; companyImage.RefCompanyId = 'etl'; companyImage.Image = cont; if (companyImage.RecId) emplTable.update(); else companyImage.insert(); } retVal.finalize(); propertyGet.finalize(); |
|