zoukankan      html  css  js  c++  java
  • SysMultiTableLookup class

    https://files.cnblogs.com/Jimmyx/Class_SysMultiTableLookup.rar

    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

    commont lookup method in tables

     

    // <GBR>
    public client static void lookupByInventLocationType_BR(FormStringControl ctrl, InventLocationType _inventLocationType)
    {
        SysTableLookup       sysTableLookup = SysTableLookup::newParameters(tablenum(InventLocation), ctrl);
        Query                query = new Query();
        QueryBuildDataSource queryBuildDataSource;
        ;

        sysTableLookup.addLookupfield(fieldnum(InventLocation, InventLocationId));
        sysTableLookup.addLookupfield(fieldnum(InventLocation, Name));
        sysTableLookup.addLookupfield(fieldnum(InventLocation, InventSiteId));

        queryBuildDataSource = query.addDataSource(tablenum(InventLocation));
        queryBuildDataSource.addRange(fieldnum(InventLocation, InventLocationType)).value(queryValue(_inventLocationType));

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

    // </GBR>

    Lookup method on the salesLine Form
    public void lookup(FormControl _formControl, str _filterStr)
    {
    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(_formControl,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(InventTableModule,price),
    2) ;
    sysTableLookup.addLookupField(fieldNum(InventTableModule,UnitId),
    2) ; // get a field from another table. 2 is second datasource


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

    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
    // super(_formControl, _filterStr);
    }
  • 相关阅读:
    hibernate映射-单向多对一映射
    CSS
    HTML基础
    复习
    元类,单例
    数据类型,约束,存储引擎
    数据库概念,安装,基本操作
    IO模型
    异步回调,协程
    GIL锁,线程池,同步异步
  • 原文地址:https://www.cnblogs.com/Fandyx/p/1896965.html
Copyright © 2011-2022 走看看