0

我需要以任何形式将附件的内容复制到 AX2012 中的特定记录,然后我必须将此内容粘贴到同一表单下的任何字符串类型字段中。

我正在尝试执行此操作:

public void getdocucontent()
{
    Dev_ManageTemplates obj_Dev_ManageTemplates;
    DocuRef obj_docuRef;
    DocuValue obj_DocuValue;
    RecId recid;

    TextIo txIoRead,
         txIoWrite;
    FileIOPermission fioPermission;
    TextBuffer txtb;
    container containFromRead;
    int xx,num,
        iConLength;
    str sTempPath,
        sFileName, completename ;
    str 64 s1;
    ;
   Dev_ManageTemplates_ds.getFirst(true);
    recid = Dev_ManageTemplates.RecId;

   select obj_docuRef
        where obj_docuRef.RefRecId == recid;

    select obj_DocuValue
        where obj_DocuValue.name == obj_docuRef.Name;

    sTempPath = obj_docuRef.path();
    sFileName = obj_DocuValue.FileName;
    completename = sTempPath+sFileName+"."+obj_DocuValue.FileType;


   fioPermission = new FileIoPermission("completename",'r');
   txtb = new TextBuffer();
    fioPermission.assert();
    txtb.fromFile("completename"); // Read text from file
    //txtb.toString(); // Copy it to the clipboard
   // StringEdit.text(txtb.getText());
    s1 = txtb.getText();
   // info(txtb.getText());

}
4

1 回答 1

2

当您阅读代码时,错误很明显:

new FileIoPermission("completename",'r').assert();
txtb = new TextBuffer();
txtb.fromFile("completename"); 

真的应该是:

new FileIoPermission(completename,'r').assert();
txtb = new TextBuffer();
txtb.fromFile(completename); 

此外,在 AX 中使用匈牙利表示法并不是最佳实践

于 2013-01-10T12:20:25.400 回答