Pages

Banner 468 x 60px

 

Tuesday, November 21, 2017

Lookup in x++

0 comments
Lookup in x++ :

public void lookup()
{
    Query Query ;
    QueryBuildDataSource QBDS;
     
    SysTableLookup systbl=SysTableLookup::newParameters(tableNum(CustTable),this);
    systbl.addLookupfield(fieldNum(CustTable,AccountNum));
    systbl.addLookupfield(fieldNum(CustTable,CustGroup));
    Query=new Query();
    QBDS=Query.addDataSource(tableNum(CustTable));
   
    systbl.parmQuery(Query);
    systbl.performFormLookup();
}

public void lookup()
{
Query           query;
SysTableLookup  sysTableLookup;

super();

sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionAttribute), this);
sysTableLookup.addLookupfield(fieldNum(DimensionAttribute, Name));
query = new Query();
query.addDataSource(tableNum(DimensionAttribute)).addRange(fieldNum(DimensionAttribute, Type)).value(queryValue(DimensionAttributeType::CustomList));

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



qbrStatement = this.query().dataSourceName("BankAccountTrans2").addRange(fieldnum(BankAccountTrans,AccountStatement));

//qbrStatement.value("!?*");//this is the old way that may not work in future versions of AX

qbrStatement.value(sysquery::valueEmptyString());//this is the new way


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

    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(salesline), this);
    ;

    queryBuildDataSource = query.addDataSource(tableNum(salesline));
    queryBuildDataSource.orderMode(OrderMode::GroupBy);
    queryBuildDataSource.addSortField(fieldnum(salesline, BIT_RetentionRealization));
 
    queryBuildRange = queryBuildDataSource.addRange(fieldNum(salesline, Salesid));
    queryBuildRange.value(queryvalue(GGSalesID.valueStr()));

    sysTableLookup.parmQuery(query);
 
    sysTableLookup.addLookupField(fieldNum(salesline, BIT_RetentionRealization));
 
    sysTableLookup.parmUseLookupValue(false);
    sysTableLookup.performFormLookup();
}

static void ProjTableQuery(Args _args)
{
    Query   query;
    QueryBuildDataSource    qdbs1;
    QueryBuildDataSource    qdbs2;
    QueryBuildRange         qbr1;
    QueryBuildRange         qbr2;
    QueryRun                queryrun;
    ProjTable               projtable;

    query = new Query();

    qdbs1 = Query.addDataSource(tableNum(ProjTable));
    qdbs1.addSortField(
    fieldNum(ProjTable, Name),
    SortOrder::Ascending);

    qbr1 = qdbs1.addRange(fieldNum(ProjTable,Type));
    qbr1.value(queryValue(ProjType::FixedPrice));
    qbr2 = qdbs1.addRange(fieldNum(ProjTable,ProjId));
    qbr2.value(queryValue('2') + '*');
    qdbs2 = qdbs1.addDataSource(tableNum(ProjEmplTrans));
    qdbs2.relations(true);
    qdbs2.joinMode(JoinMode::ExistsJoin);
    queryRun = new QueryRun(query);
while (queryRun.next())
{
projTable = queryRun.get(tableNum(ProjTable));
info(strFmt(
"%1, %2, %3",
projTable.ProjId,
projTable.Name,
projTable.Type));
}
}


/*
public void lookup()
{
    TECCustInOutClaimTable  CustInOutClaimTable;
    SysTableLookup        sysTableLookup       = SysTableLookup::newParameters(tablenum(RetailTransactionSalesTrans), this);
    Query                 query                = new Query();
    QueryBuildDataSource  queryBuildDataSource = query.addDataSource(tablenum(RetailTransactionSalesTrans));
    QueryBuildRange       queryBuildRange      = queryBuildDataSource.addRange(fieldnum(RetailTransactionSalesTrans, receiptId));
    ;

    //super();
    select CustInOutClaimTable where CustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
    queryBuildRange.value(CustInOutClaimTable.RetailReceiptId);

    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
    sysTableLookup.addLookupMethod('itemName');
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}
*/

public void Lookup()
{
    TECCustInOutClaimTable  CustInOutClaimTable;
    TECDeliveryOrderTable   TECDeliveryOrderTable;
    SysTableLookup          sysTableLookup  = SysTableLookup::newParameters(tableNum(RetailTransactionSalesTrans), this);
    Query                   query           = new Query();
    QueryBuildDataSource    queryBuildDataSource    = query.addDataSource(tableNum(RetailTransactionSalesTrans));
    QueryBuildRange         queryBuildRange         = queryBuildDataSource.addRange(fieldNum(TECDeliveryOrderTable, invoiceId));
    ;


    select CustInOutClaimTable where CustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
    select CustInOutClaimTable where CustInOutClaimTable.RetailReceiptId == TECDeliveryOrderTable.invoiceId && TECDeliveryOrderTable.TECOrderStatus == TECOrderStatus::Finish;



    systablelookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, ItemId));
    sysTableLookup.addLookupMethod('itemName');
    sysTableLookup.addLookupfield(fieldNum(RetailTransactionSalesTrans, Qty));
    sysTableLookup.addLookupfield(fieldNum(RetailTransactionSalesTrans, netAmountInclTax));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}



public void lookup()
{
    TECCustInOutClaimTable  CustInOutClaimTable;

    InventTable             _InventTable;
    TECDeliveryOrderTable   _TECDeliveryOrderTable;
    RetailTransactionTable  _RetailTransactionTable;
    RetailTransactionSalesTrans _RetailTransactionSalesTrans;
    TECCustInOutClaimTable  _TECCustInOutClaimTable;

    Query                   query = new Query();
    QueryBuildDataSource    qbds;
    QueryBuildDataSource    qbdsJoin;
    QueryBuildRange         qbr1, qbr2;
    SysTableLookup          sysTableLookup = sysTableLookup::newParameters(tableNum(RetailTransactionSalesTrans), this);
    ;

    qbds= query.addDataSource(tableNum(RetailTransactionSalesTrans));
    qbr1 = qbds.addRange(fieldNum(RetailTransactionSalesTrans,receiptId));

    qbdsJoin= qbds.addDataSource(tableNum(TECDeliveryOrderTable));
    qbr2 = qbdsJoin.addRange(fieldNum(TECDeliveryOrderTable, TECOrderStatus));
    qbr2.value(enum2str(TECOrderStatus::Finish));

    select CustInOutClaimTable where CustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
    qbr2.value(CustInOutClaimTable.RetailReceiptId);

    qbdsJoin.relations(false);
    qbdsJoin.fields().dynamic(NoYes::Yes);
    qbdsJoin.addLink(fieldNum(TECCustInOutClaimTable,RetailReceiptId), fieldNum(TECDeliveryOrderTable,invoiceId));
    qbdsJoin.joinMode(JoinMode::InnerJoin);




    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
    sysTableLookup.addLookupMethod('itemName');
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

public void lookup()
{
    TECCustInOutClaimTable  CustInOutClaimTable;
    SysTableLookup        sysTableLookup       = SysTableLookup::newParameters(tablenum(RetailTransactionSalesTrans), this);
    Query                 query                = new Query();
    QueryBuildDataSource  queryBuildDataSource = query.addDataSource(tablenum(RetailTransactionSalesTrans));
    QueryBuildRange       queryBuildRange      = queryBuildDataSource.addRange(fieldnum(RetailTransactionSalesTrans, receiptId));
    ;

    //super();
    select CustInOutClaimTable where CustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
    queryBuildRange.value(CustInOutClaimTable.RetailReceiptId);

    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
    sysTableLookup.addLookupMethod('itemName');
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}



public void lookup()
{
    TECCustInOutClaimTable  TECCustInOutClaimTable;

    InventTable                 _InventTable;
    TECDeliveryOrderTable       _TECDeliveryOrderTable;
    RetailTransactionSalesTrans _RetailTransactionSalesTrans;
    TECCustInOutClaimTable      _TECCustInOutClaimTable;
    InventJournalTable          _InventJournalTable;
    InventLocation              _InventLocation;

    Query                   query = new Query();
    QueryBuildDataSource    qbdsRetailTransactionSalesTrans, qbdsTECCustInOutClaimTable, qbdsTECDeliveryOrderTable;
    QueryBuildDataSource    qbdsJoin;

    QueryBuildRange         qbrRetailTransactionSalesTrans, qbrTECCustInOutClaimTable, qbrTECDeliveryOrderTable;
    SysTableLookup          sysTableLookup = sysTableLookup::newParameters(tableNum(RetailTransactionSalesTrans), this);
    ;

    select TECCustInOutClaimTable where TECCustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
    select _TECDeliveryOrderTable where _TECDeliveryOrderTable.invoiceId == TECCustInOutClaimTable.RetailReceiptId;
 
                        qbdsRetailTransactionSalesTrans= query.addDataSource(tableNum(RetailTransactionSalesTrans));
                        qbrRetailTransactionSalesTrans = qbdsRetailTransactionSalesTrans.addRange(fieldNum(RetailTransactionSalesTrans,receiptId));
                        qbdsRetailTransactionSalesTrans.relations(true);

                        qbdsTECCustInOutClaimTable = qbdsRetailTransactionSalesTrans.addDataSource(tableNum(TECCustInOutClaimTable));
                        qbrTECCustInOutClaimTable = qbdsTECCustInOutClaimTable.addRange(fieldNum(TECCustInOutClaimTable, RetailReceiptId));
                        qbrTECCustInOutClaimTable.value(TECCustInOutClaimTable.RetailReceiptId);
                        qbdsTECCustInOutClaimTable.relations(true);

                        qbdsTECDeliveryOrderTable= qbdsTECCustInOutClaimTable.addDataSource(tableNum(TECDeliveryOrderTable));
                        qbrTECDeliveryOrderTable = qbdsTECDeliveryOrderTable.addRange(fieldNum(TECDeliveryOrderTable, TECOrderStatus));
                        qbrTECDeliveryOrderTable.value(queryValue(TECOrderStatus::Finish));
                        qbdsTECDeliveryOrderTable.relations(true); 
           
                qbdsTECDeliveryOrderTable.fields().dynamic(NoYes::Yes); 
                qbdsTECDeliveryOrderTable.addLink(fieldNum(TECCustInOutClaimTable,RetailReceiptId), fieldNum(TECDeliveryOrderTable,invoiceId));
                qbdsTECDeliveryOrderTable.joinMode(JoinMode::ExistsJoin);           
 
                if(TECCustInOutClaimTable.RetailReceiptId == _TECDeliveryOrderTable.invoiceid)
                {
                    select TECCustInOutClaimTable where TECCustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
                    qbrRetailTransactionSalesTrans.value(TECCustInOutClaimTable.RetailReceiptId);

                    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
                    sysTableLookup.addLookupMethod('itemName');
                    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
                    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
                    sysTableLookup.parmQuery(query);
                    sysTableLookup.performFormLookup();
                 
                }
                else         
                {
                    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
                    sysTableLookup.addLookupMethod('itemName');
                    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
                    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
                    sysTableLookup.parmQuery(query);
                    sysTableLookup.performFormLookup();
                }             
 
}


client static void lookupVATNum (FormStringControl ctrl, Common common)
{
    SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tableNum(TaxVATNumTable), ctrl);
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource = query.addDataSource(tableNum(TaxVATNumTable));
    QueryBuildRange         queryBuildRange = queryBuildDataSource.addRange(fieldNum(TaxVATNumTable, CountryRegionId));
    ;

    //Remove countryRegionId restrain to display all tax exempt numbers
    // add by tyo - EDD Vendor V.0.2 - Data TAX Exempt Number / Vendor NPWP
    queryBuildRange = queryBuildDataSource.addRange(fieldNum(TaxVATNumTable, TIDMultiNPWP));
    queryBuildRange.value(SysQuery::value(NoYes::Yes));
    // end by tyo - EDD Vendor V.0.2 - Data TAX Exempt Number / Vendor NPWP
    sysTableLookup.addLookupfield(fieldNum(TaxVATNumTable, vatNum));
    sysTableLookup.addLookupfield(fieldNum(TaxVATNumTable, Name));
    sysTableLookup.addLookupfield(fieldNum(TaxVATNumTable, CountryRegionId));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}


AssetJournal\createTrans >
ledgerJournalTrans.Txt                      = transactionTxt.txt();


public void lookup()
{

    TECDeliveryOrderTable           _TECDeliveryOrderTable;
    RetailTransactionSalesTrans     _RetailTransactionSalesTrans;
    TECOrderStatus                  Status = _TECDeliveryOrderTable.TECOrderStatus;
    TECCustInOutClaimTable          _TECCustInOutClaimTable;
    RetailTransactionTable          _RetailTransactionTable;

    SysTableLookup                  sysTableLookup       = SysTableLookup::newParameters(tablenum(RetailTransactionSalesTrans), this);

    Query                           query                = new Query();
    QueryBuildDataSource            queryBuildDataSource = query.addDataSource(tablenum(RetailTransactionSalesTrans));
    QueryBuildRange                 queryBuildRange      = queryBuildDataSource.addRange(fieldnum(RetailTransactionSalesTrans, receiptId));

    select _TECCustInOutClaimTable where _TECCustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
    queryBuildRange.value(_TECCustInOutClaimTable.RetailReceiptId);

                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
                sysTableLookup.addLookupMethod('itemName');
                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
                sysTableLookup.parmQuery(query);
                sysTableLookup.performFormLookup();
}

 public void lookup()
{
      TECDeliveryOrderTable   TECDeliveryOrderTable;
    RetailTransactionSalesTrans RetailTransactionSalesTrans;
    TECOrderStatus          Status = TECDeliveryOrderTable.TECOrderStatus;

      TECCustInOutClaimTable  CustInOutClaimTable;
      TECDeliveryOrderTable           _TECDeliveryOrderTable;
    RetailTransactionSalesTrans     _RetailTransactionSalesTrans;
    TECOrderStatus                  Status = _TECDeliveryOrderTable.TECOrderStatus;
    TECCustInOutClaimTable          _TECCustInOutClaimTable;
    RetailTransactionTable          _RetailTransactionTable;

      SysTableLookup                  sysTableLookup       = SysTableLookup::newParameters(tablenum(RetailTransactionSalesTrans), this);

      Query                           query                = new Query();
    QueryBuildDataSource            queryBuildDataSource = query.addDataSource(tablenum(RetailTransactionSalesTrans));
    QueryBuildRange                 queryBuildRange      = queryBuildDataSource.addRange(fieldnum(RetailTransactionSalesTrans, receiptId));

      SysTableLookup        sysTableLookup       = SysTableLookup::newParameters(tablenum(RetailTransactionSalesTrans), this);
      select _TECCustInOutClaimTable where _TECCustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
    queryBuildRange.value(_TECCustInOutClaimTable.RetailReceiptId);

      Query                 query                = new Query();
    QueryBuildDataSource  queryBuildDataSource = query.addDataSource(tablenum(RetailTransactionSalesTrans));
    QueryBuildRange       queryBuildRange      = queryBuildDataSource.addRange(fieldnum(RetailTransactionSalesTrans, receiptId));
                  sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
                sysTableLookup.addLookupMethod('itemName');
                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
                sysTableLookup.parmQuery(query);
                sysTableLookup.performFormLookup();
}

    /*
    // Add by Tyo
       InventTable                  _InventTable;
       CustInvoiceJour              _CustInvoiceJour;
    // End by Tyo
      ;

      // Add by tyo
       select _TECCustInOutClaimTable where _TECCustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;

      //if(Status == TECOrderStatus::Finish)
    //{
         select _RetailTransactionTable where _RetailTransactionTable.entryStatus == 2
       || _RetailTransactionTable.entryStatus == 0
       && _RetailTransactionTable.saleIsReturnSale == 0
       && _RetailTransactionTable.type == 2
       && _TECCustInOutClaimTable.RetailReceiptId == _RetailTransactionTable.receiptId;

      //super();
         select _RetailTransactionSalesTrans where _RetailTransactionSalesTrans.transactionId == _RetailTransactionTable.transactionId
       && _RetailTransactionSalesTrans.store == _RetailTransactionTable.store
       && _RetailTransactionSalesTrans.terminalId == _RetailTransactionTable.terminal;

          select itemId from RetailTransactionSalesTrans where RetailTransactionSalesTrans.custAccount
        && CustInOutClaimTable.CustAccount == TECDeliveryOrderTable.custAccount
            && Status == TECOrderStatus::Finish;
         select _InventTable where _InventTable.ItemId == _RetailTransactionSalesTrans.itemId;

      select CustInOutClaimTable where CustInOutClaimTable.RecId == TECCustInOutClaimLine.TECCustInOutClaimTableRefRecId;
         select _TECDeliveryOrderTable where _TECDeliveryOrderTable.ItemId == _InventTable.ItemId;


      if(_RetailTransactionSalesTrans.receiptId  == _TECDeliveryOrderTable.invoiceId && _TECDeliveryOrderTable.TECOrderStatus == TECOrderStatus::Finish && TECCustInOutClaimLine.IsDelivery == NoYes::Yes)
       {


      queryBuildRange.value(CustInOutClaimTable.RetailReceiptId);
              queryBuildRange.value(_TECCustInOutClaimTable.RetailReceiptId);

    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
    sysTableLookup.addLookupMethod('itemName');
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
    sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
    //}
    //else
              sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
            sysTableLookup.addLookupMethod('itemName');
            sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
            sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
            sysTableLookup.parmQuery(query);
            sysTableLookup.performFormLookup();
        }

    else
     {
            if (TECCustInOutClaimLine.IsDelivery == NoYes::no)
            {

                select * from _RetailTransactionSalesTrans where _RetailTransactionSalesTrans.custAccount == _TECCustInOutClaimTable.CustAccount
                && _TECCustInOutClaimTable.CustAccount == _TECDeliveryOrderTable.custAccount
                && Status == TECOrderStatus::Finish;


               queryBuildRange.value(_TECCustInOutClaimTable.RetailReceiptId);

                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, itemId));
                sysTableLookup.addLookupMethod('itemName');
                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, qty));
                sysTableLookup.addLookupfield(fieldnum(RetailTransactionSalesTrans, netAmountInclTax));
                sysTableLookup.parmQuery(query);
                sysTableLookup.performFormLookup();
            }

            else
            {
                box::stop('Delivery order unfinished','Please check again your delivery order','Stop');
            }

    }

   // End by tyo
  }

client static void lookupVATNum (FormStringControl ctrl, Common common)
{
    SysTableLookup          sysTableLookup = SysTableLookup::newParameters(tableNum(TaxVATNumTable), ctrl);
    Query                   query = new Query();
    QueryBuildDataSource    queryBuildDataSource = query.addDataSource(tableNum(TaxVATNumTable));
    QueryBuildRange         queryBuildRange = queryBuildDataSource.addRange(fieldNum(TaxVATNumTable, CountryRegionId));
    ;

    //Remove countryRegionId restrain to display all tax exempt numbers
    // add by tyo - EDD Vendor V.0.2 - Data TAX Exempt Number / Vendor NPWP
    queryBuildRange = queryBuildDataSource.addRange(fieldNum(TaxVATNumTable, VendorID));
    queryBuildRange.value(SysQuery::value(VendTable::findRecId(common.RecId).AccountNum));
    // end by tyo - EDD Vendor V.0.2 - Data TAX Exempt Number / Vendor NPWP
    sysTableLookup.addLookupfield(fieldNum(TaxVATNumTable, vatNum));
    sysTableLookup.addLookupfield(fieldNum(TaxVATNumTable, Name));
    sysTableLookup.addLookupfield(fieldNum(TaxVATNumTable, CountryRegionId));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();
}

CATATAN lookup ini ditaruh di Design, bukan di field pada Datasource


public void lookup()
{
    sysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(TECReasonScrap), this);
    Query query = new Query(); // this query will be used by the lookup form
    QueryBuildDataSource    qbds;
    ;
 
    sysTableLookup.addLookupfield(fieldNum(TECReasonScrap, Name));
    sysTableLookup.addLookupfield(fieldNum(TECReasonScrap, TECScrapType));
 
    qbds = query.addDataSource(tableNum(TECReasonScrap));
    qbds.addRange(fieldNum(TECReasonScrap, TECScrapType)).value(queryValue(TECScrapType::Rework));
 
    // Passes the query to the sysTableLookup.
    sysTableLookup.parmQuery(query);
 
    //Activates the lookup.
    sysTableLookup.performFormLookup();
 
}


public void lookup()
{
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(TECReasonScrap), this);
    Query query = new Query(); // This query will be used by the lookup form.
    QueryBuildDataSource qbds;
    ;

    sysTableLookup.addLookupField(fieldnum(TECReasonScrap, Name));
    sysTableLookup.addLookupField(fieldnum(TECReasonScrap, ScrapCode));
    sysTableLookup.addLookupField(fieldnum(TECReasonScrap, TECScrapType));

    qbds = query.addDataSource(tablenum(TECReasonScrap));
    qbds.addRange(fieldnum(TECReasonScrap, TECScrapType)).value(queryValue(TECScrapType::Rework));

    // Passes the query to the sysTableLookup.
    sysTableLookup.parmQuery(query);

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

0 comments:

A financial dimension value is based on the record and has been used on a transaction. You cannot delete the record

  SOLUTION delete in table DimensionAttributeLevelValue base on Bank Account  :  and Delete the Bank Account FINISH