Ax X ++覆盖对话框表单字段过滤器CustAccount

时间:2012-11-07 15:49:12

标签: axapta x++

我的对话框有类似问题,但是我收到错误,没有控制调用方法。

我试图覆盖CustAccount类型的对话框字段上的查找 - 我想要的是查找返回invoiceAccount具有特定值的所有custTable记录。

这是我的代码:

class AG_UpdateQuoteCust extends Runbase
{
DialogField                 dlgCust;
CustAccount                 newCust;
CustAccount                 custAccount;

#define.CurrentVersion(1)
#define.Version1(1)
#localmacro.CurrentList
    custAccount
#endmacro
}


public Object dialog()
{

DialogRunbase      dlg;
;

dlg = super(dlg);

dlg.caption("Change quotation customer account");


dlg.addText('Please select an alternative customer account');

dlgCust     = dlg.addField(typeid(CustAccount),'Customer account');

dlgCust.fieldControl().mandatory(true);

if(!dlgCust)
{
    error('Please fill out all mandatory fields');
}

return dlg;
}

void Fld2_1_lookup()
{
    Dialog                  dlg = this.dialog();
    SysTableLookup          sysTableLookup;
    QueryBuildDataSource    queryBuildDataSource;
    QueryBuildRange         queryBuildRange;
    Query                   query;
    Str                     TmpStr;
    Formrun                 fr = this.dialogModify().parmDialog();
    Object                  Control = fr.controlCallingMethod();


    FormStringControl              _control = control;
    ;

    sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable),_control);

    sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum),true);
    sysTableLookup.addLookupfield(fieldnum(CustTable, Name));
    sysTableLookup.addLookupfield(fieldnum(CustTable, NameAlias));

    query = new Query();

    queryBuildDataSource = query.addDataSource(tablenum(CustTable));

    tmpStr = 'ADAM001H';

    queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, InvoiceAccount));
    queryBuildRange.value(TmpStr);


    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();
}

public void dialogPostRun(DialogRunbase dialog)
{

;

Super(dialog);
dialog.formRun().controlMethodOverload(true);
dialog.formRun().controlMethodOverloadObject(this);
}

你能否告诉我这里出错的地方 - 实际上我并不理解dialogPostRun方法的这种重写或者使用ControlCallingMethod。

0 个答案:

没有答案