public void lookup()
        {
            super();

            // Declaration           
            Query                   query          = new Query();
            QueryBuildDataSource    queryBuildDataSource;
            QueryBuildRange         queryBuildRange;
            str _dimensionKey = 'DimensionFinancialTag';

            // Define Lookup
            SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(DimensionAttribute), this);
            ;

            // Add fields to be shown in the lookup form.
            sysTableLookup.addLookupfield(fieldnum(DimensionAttribute,name));

            queryBuildDataSource = query.addDataSource(tablenum(DimensionAttribute));
            queryBuildDataSource.addRange(fieldnum(DimensionAttribute,TranslationKeyFieldName)).value(_dimensionKey);

            sysTableLookup.parmQuery(query);

            // Perform the lookup.
            sysTableLookup.performFormLookup();
        }

 

//-------------------------------------------------------------//

以下是如何在LookUp 內使用METHOD 和, 如何找到dimensionAttribute Name:

 

public void lookup()
        {
            Query                   query          = new Query();
            QueryBuildDataSource    queryBuildDataSource, queryBuildDataSourceJoin;
            QueryBuildRange         queryBuildRange;

            SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(DimensionAttributeValue), this); // 指定table 內找尋
            ;

            // Add fields to be shown in the lookup form.
            sysTableLookup.addLookupfield(fieldnum(DimensionAttributeValue, DisplayValue), true);  //指定顯示目標
            sysTableLookup.addLookupMethod(tableMethodStr(DimensionAttributeValue, getName));   //指定顯示目標

            queryBuildDataSource = query.addDataSource(tablenum(DimensionAttributeValue));
            queryBuildDataSourceJoin = queryBuildDataSource.addDataSource(tableNum(DimensionAttribute));
            queryBuildDataSourceJoin.joinMode(JoinMode::InnerJoin);
            queryBuildDataSourceJoin.addLink(fieldNum(DimensionAttributeValue, DimensionAttribute), fieldNum(DimensionAttribute, RecId));

            queryBuildDataSourceJoin.addRange(fieldnum(DimensionAttribute,Name)).value(enum2str(sysdimension::Department));

            sysTableLookup.parmQuery(query);

            // Perform the lookup.
            sysTableLookup.performFormLookup();
        }

創作者介紹
創作者 lionlionchopper 的頭像
lionlionchopper

呆子獅的夢想世界

lionlionchopper 發表在 痞客邦 留言(0) 人氣()