hljs.configure({cssSelector: "code"}); hljs.highlightAll();

Friday, August 7, 2020

Filtering the SalesOrders Using Dynamic Query X++

Hii guys, 

             Today we are going to learn about sales order filtering based on certain fields using Dynamic queries  and filtered values will store in my temp table.

void clicked()

{


Query query = new Query();

QueryBuildDataSource qbds;

QueryBuildRange qbr,Qbr1;

QueryRun qr;

SalesTable salesTable;

DaxSalesTable DaxSalesTableloc; // temporary table

delete_from DaxSalesTableloc; 


qbds=query.addDataSource(tableNum(salesTable));


qbr = qbds.addrange(fieldnum(salesTable, CustAccount));

qbr1 = qbds.addrange(fieldnum(salesTable, SalesStatus));

qbr.value(StringEdit.valueStr());//unbound controls

qbr1.value(ComboBox.valueStr());//unbound controls

qr = new QueryRun(query);


while (qr.next())

{

salesTable = qr.get(tablenum(SalesTable));

// inserting filtered values in my own temp table

DaxSalesTableloc.CustAccount = salesTable.CustAccount;

DaxSalesTableloc.InvoiceAccount = salesTable.InvoiceAccount;

DaxSalesTableloc.SalesId = salesTable.SalesId;

DaxSalesTableloc.SalesStatus = salesTable.SalesStatus;

DaxSalesTableloc.insert();


DaxSalesTable_ds.executeQuery();

}



}

That's it! Thank you all

Keep Daxing!! 

No comments:

Post a Comment