zoukankan      html  css  js  c++  java
  • Dynamics AX 4.0 多表looup

    project rar:http://files.cnblogs.com/files/sxypeace/PrivateProject_MutilTableLookupOnCtronl.rar

    在AX 中控件的looup方法需要展示多表数据的时候,需要新建一个lookupFrom ,或者将所有数据写入临时表才能达到目的。

    翻看了一下ClasssysTableLook,发现其实是动态创建form添加数据源显示控件来实现的。

    于是new了一个新的ClasssysViewLook,来实现多表lookup。

    public void lookup()
    {
    
    
        SysViewLookup       SysViewLookup = new SysViewLookup();
        query               query = new query();
        queryBuildDatasource    qbds1;
        queryBuildDatasource    qbds2;
        queryBuildDatasource    qbds3;
        ;
    
    
        //must add by desc sorting
        SysViewLookup.parmAddLookupTableId( tableNum(InventDim));
        SysViewLookup.parmAddLookupTableId( tableNum(SalesLine));
        SysViewLookup.parmAddLookupTableId( tableNum(SalesTable));
    
        qbds1 = query.addDataSource(tableNum(SalesTable));
        qbds2 = qbds1.addDataSource(tablenum(salesLine));
        qbds2.relations( true);
        qbds3 = qbds2.addDataSource(tableNum(InventDim));
        qbds3.relations(true);
    
        sysQuery::findOrCreateRange( qbds2, fieldNum(salesLine,ItemId)).value("22MA*00K");
        qbds1.addSortField( fieldNum(SalesTable,CreatedDate),SortOrder::Descending);
        qbds1.addSortField( fieldNum(SalesTable,SalesId),SortOrder::Descending);
        qbds1.addSortField( fieldNum(SalesTable,CustAccount),SortOrder::Ascending);
        qbds2.addSortField( fieldNum(SalesLine,ItemId),SortOrder::Ascending);
        qbds2.addSortField( fieldNum(InventDim,InventSizeId),SortOrder::Ascending);
    
        SysViewLookup.parmCallingControl( this);
        SysViewLookup.addLookupfield( TableNum(salesTable), fieldNum(SalesTable,CreatedDate));
        SysViewLookup.addLookupfield( TableNum(salesTable), fieldNum(SalesTable,SalesId),true);
        SysViewLookup.addLookupfield( TableNum(salesTable), fieldNum(SalesTable,CustAccount));
        SysViewLookup.addLookupfield( TableNum(SalesLine), fieldNum(SalesLine,ItemId));
        SysViewLookup.addLookupfield( TableNum(InventDim), fieldNum(InventDim,InventSizeId));
    
        SysViewLookup.parmQuery( query);
        SysViewLookup.performFormLookup();
    }
    

    附完整代码的下载地址 http://files.cnblogs.com/files/sxypeace/PrivateProject_MutilTableLookupOnCtronl.rar

     

  • 相关阅读:
    [USACO08MAR]土地征用Land Acquisition
    树链剖分
    [AHOI2008]紧急集合 / 聚会
    P1852 [国家集训队]跳跳棋
    Ant Trip(欧拉回路+并查集)
    单词游戏
    POJ3694 Network
    C++ STL小总结
    2-Sat专题
    6大名家带你穿越大半个中国去深思
  • 原文地址:https://www.cnblogs.com/sxypeace/p/4872172.html
Copyright © 2011-2022 走看看