X++:
// AOSRunMode::client - this method is always called on the client, which eliminates the need for a CAS assert.
public static client DocuValue writeDocuValue(DocuRef docuRef, Filename filename = '', BinData binData = null)
{
DocuValue docuValue;
DocuType docuType;
;
ttsbegin;
docuType = docuRef.docuType();
docuValue = docuRef.docuValue(true);
[docuValue.FileName, docuValue.FileType, docuValue.Path] = Docu::splitFilename(filename);
if (docuType.FilePlace != DocuFilePlace::NoCopy)
docuValue.Path = ''; //path is already stored in ArchivePath in docuType or docuParameters
if (docuType.FilePlace == DocuFilePlace::Database)
{
// Insert to database
if (WinAPI::fileLocked(filename))
{
info("@SYS72783",'',SysInfoAction_Formrun::newFormnameControlnameDesc(formstr(DocuOpenFile), identifierstr(Grid), "@SYS4167"));
}
else
{
if (! binData)
{
binData = new BinData();
if (binData.loadFile(filename)) //only works if file not locked
{
docuValue.File = binData.getData();
}
else
throw error(strfmt("@SYS54217",filename));
}
else
docuValue.File = binData.getData();
}
}
docuValue.update();
ttscommit;
return docuValue;
}
где docuValue.File имеет вид container.