导航

AX 2012 两种lookup 的显示方式

Posted on 2015-08-27 15:17  Tokywu  阅读(733)  评论(0编辑  收藏  举报

第一种:只能单选的lookup:

代码:

public void BusinessUnitLookup(FormStringControl    _formstrcontroll)
{
    //OMOperatingUnit::operatingUnitLookup(_formstrcontroll,OMOperatingUnitType::OMBusinessUnit);
    Query query;
    SysTableLookup sysTableLookup;
    container   con;

    delete_from unposttmp;
    unposttmp.clear();
    unposttmp.BusinessUnit   = "ALL";
    unposttmp.insert();
    while select businessunit
        order by Name
    {
        unposttmp.clear();
        unposttmp.BusinessUnit   = businessunit.Name;
        unposttmp.insert();
    }


    sysTableLookup = SysTableLookup::newParameters(tableNum(GZ_BusinessUnitLookup), _formstrcontroll);
    sysTableLookup.addLookupfield(fieldNum(GZ_BusinessUnitLookup, BusinessUnit));
    sysTableLookup.parmTmpBuffer(unposttmp);
    sysTableLookup.performFormLookup();

}

 

第二种,可多选lookup,

 

代码:

public void createdbylookup(FormStringControl   _formstringcontrol)
{
    Query       query;
    container   con;
    ;
    query = new Query();
    query.addDataSource(tableNum(UserInfo));
    query.dataSourceNo(1).fields().dynamic(NoYes::Yes);
    query.dataSourceNo(1).fields().addField(fieldNum(UserInfo,Id));
    query.dataSourceNo(1).fields().addField(fieldNum(UserInfo,Name));

    SysLookupMultiSelectGrid::lookup(query,_formstringcontrol,_formstringcontrol,con);


}