Axapta: Multi tables lookup

 

/Files/JackyXu1981/SysMultiTableLookup.rar   SysMultiTableLookup Class DownLoad

The SysMultiTableLookup.rar is a class to show multi table information.

When you want to create a sales line in SO, You can selet an item and see some information of item. Those information is from invent table.

But sometimes you want those information from multi tables, How to do?

SysMultiTableLookup class provide a solution to it.

It is from http://kashperuk.blogspot.com/

I had used it on creating a sales line.

Overwrite lookup method of SalesLine_ItemId on SalesTable Form

 

public void lookup()
{
    Query                   query          = new Query();
    QueryBuildDataSource    queryBuildDataSource,queryBuildDataSource2 ;
    QueryBuildRange         queryBuildRange;
    SysMultiTableLookup          sysTableLookup ;  //Not SysTableLookup class
    ;


    queryBuildDataSource = query.addDataSource(tableNum(InventTable));    //link a another table
    queryBuildDataSource2 = queryBuildDataSource.addDataSource(tablenum(InventTableModule));
    queryBuildDataSource2.joinMode(JoinMode::InnerJoin) ;
    queryBuildDataSource2.relations(true) ;

    sysTableLookup =SysMultiTableLookup::newParameters(this,query) ;

    sysTableLookup.addLookupField(fieldNum(InventTable, ItemId));
    sysTableLookup.addLookupField(fieldNum(InventTable, ItemName));
    sysTableLookup.addLookupField(fieldNum(InventTable, NameAlias));
    sysTableLookup.addLookupfield(fieldNum(InventTable, ItemGroupId));
    sysTableLookup.addLookupfield(fieldNum(InventTable, ItemType));
    sysTableLookup.addLookupfield(fieldNum(InventTable, HDSH_ItemOriginName));
    sysTableLookup.addLookupfield(fieldNum(InventTable, HDSH_PrevItemId));
    sysTableLookup.addLookupField(fieldNum(InventTableModule,UnitId),2) ;    // get a field from another table. 2 is second datasource

    queryBuildDataSource.addRange(fieldNum(InventTable, HDSH_Visible)).value("0");
    queryBuildDataSource2.addRange(fieldNum(InventTableModule, ModuleType)).value("0");

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

 

First only need u import class: SysMultiTableLookup. 

From:http://www.cnblogs.com/JackyXu1981/articles/1338228.html

posted @ 2010-01-13 22:35  Fandy Xie  Views(169)  Comments(0Edit  收藏  举报