Monday, February 24, 2020

Passing ranges in Query through X++

Not equal to Enum Value :

qbr = qbds1.addRange(fieldNum(InventTransferTable,       TransferStatus)).value(SysQuery::valueNot(InventTransferStatus::Created));
Passing NOT equal multiple Enum values:

this.query().dataSourceTable(tablenum(PurchTable)).addRange(fieldnum(PurchTable, PurchStatus)).value(strfmt('!%1,!%2',enum2str(PurchStatus::Canceled),enum2str(PurchStatus::Invoiced)));

qbds.addRange(fieldNum(InventSite, SiteId)).value(strFmt("%1,%2",strFmt('!%1*','*_VF*'),strFmt('!%1*','*_VP*')));
      

LessThan:

qbr3 = qbds.addRange(fieldNum(CustTrans,TransDate)).value(strFmt('<%1',queryValue(asondate)));

Not Equal to 0 (Zero) :


qbds.addRange(fieldNum(CustTrans,AmountCur)).value('!0');



LessThan zero:

 qbr5 = qbds2.addRange(fieldNum(VendInvoiceJour, InvoiceAmount));
 qbr5.value(strFmt('<%1',queryValue(0)));

Not Equal to Null Values:

qbdsBankAccountTrans.addRange(fieldNum(BankAccountTrans,ChequeNum)).value(sysquery::valueNotEmptyString());
    
AND operator

qbds1.addRange(fieldNum(GeneralJournalEntry,JournalTransactionType)).value(strFmt('%1,%2',enum2str(JournalTransactionType::StockTransfer),enum2str(JournalTransactionType::StockTransferOut)));


Not equal 100:

qbds.addRange(fieldnum(VendTable,accountnum)).value(sysquery::valueNot(“100”));

pass Between Ranges:

qbds.addRange(fieldnum(VendTable,accountnum)).value(queryrange(“1″,”100”));


between two fields :

 qbr1 = queryBuildDataSource.addRange(FieldNum(CustTrans,RecId));
    qbr1.value(strFmt('((%1 < %2))',fieldStr(CustTrans, AmountCur),fieldStr(CustTrans, AmountMST)));

 Enum Values

qbds.addRange(fieldNum(InventSite, RunningOn)).value(strFmt('((%1 == %2) || (%1 == %3))', fieldStr(InventSite,RunningOn),any2int(SiteRunningOn::AX),any2int(SiteRunningOn::GOLD)));



update_recordset with joins

 update_recordset with joins update_recordSet storeTransfer         setting      TransactionId = transfertable.TransferId     join transfert...