Skip to main content

Posts

Showing posts with the label query range

How to use like in range with wildcard character in MSD axapta

 How to use like in range with wildcard character in axapta Using wildcard "Like" //The "*" symbolises the like in the statement static void useWildCards(Args _args) { Query custQuery = new Query(); QueryRun queryRun; CustTable CustTable; ; custQuery.addDataSource(tablenum(CustTable)).addRange(fieldnum(CustTable, Name)).value('L*'); queryRun = new QueryRun(custQuery); while (queryRun.next()) { custTable = queryRun.get(tablenum(CustTable)); info(custTable.Name); } }

System Classes Ranges using MSD axapta

System Classes Ranges using MS axapta SysQuery query; SysQueryRun queryRun; QueryBuildDataSource custInvoiceJourDS; QueryBuildRange rangeInvoiceAccount, rangeInvoiceDate, rangeDimensionDepartment; ; query = new Query(); custInvoiceJourDS = query.addDataSource(tablenum(CustInvoiceJour)); rangeInvoiceAccount = custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, InvoiceAccount)); rangeInvoiceAccount.value(queryValue("5000")); rangeInvoiceDate = custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, InvoiceDate)); rangeInvoiceDate.value(queryRange(datenull(), systemdateget())); rangeDimensionDepartment = custInvoiceJourDS.addRange(fieldId2Ext( fieldnum(CustInvoiceJour, Dimension), 1)); rangeDimensionDepartment.value(queryValue("Sales")); queryRun = new SysQueryRun(query); queryRun.prompt();

Advance ranges example in MSD axapta

Advance ranges example in axapta SysQuery query; SysQueryRun queryRun; QueryBuildDataSource custInvoiceJourDS, custInvoiceTransDS; ; query = new Query(); custInvoiceJourDS = query.addDataSource(tablenum(CustInvoiceJour)); custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, InvoiceAccount)); custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, CurrencyCode)); custInvoiceTransDS = custInvoiceJourDS.addDataSource(tablenum(CustInvoiceTrans)); custInvoiceTransDS.addRange(fieldnum(CustInvoiceTrans, ItemId)); custInvoiceTransDS.relations(true); queryRun = new SysQueryRun(query); queryRun.prompt();

How to show only open order of sales in MSD axapta

How to show only open order of sales in axapta FormCheckBoxControl checkBoxControl = this.controlCallingMethod(); QueryBuildRange rangeSalesStatus; Boolean ret; ; ret = checkBoxControl.modified(); rangeSalesStatus = SalesTable_ds.query().dataSourceTable(tablenum(SalesTable)).findRange(fieldnum(SalesTable, salesStatus)); if (!rangeSalesStatus) { rangeSalesStatus = SalesTable_ds.query().dataSourceTable(tablenum(SalesTable)).addRange(fieldnum(SalesTable, salesStatus)); } if (checkBoxControl.value() == NoYes::Yes) { rangeSalesStatus.enabled(true); rangeSalesStatus.value(queryValue(SalesStatus::Backorder)); } else { rangeSalesStatus.enabled(false); } SalesTable_ds.executeQuery();

Use of query elements in report using axapta

public boolean fetch() { QueryRun qr; QueryBuildRange rangeTransDate; Boolean ret; qr = new QueryRun(element); rangeTransDate = element.query().dataSourceTable(tablenum(CustTrans)).addRange(fieldnum(CustTrans, transDate)); rangeTransDate.value(queryRange(systemdateGet()-daysBack, systemDateGet())); rangeTransDate.status(RangeStatus::LOCKED); element.design().caption(strfmt("%1, %2", element.design().caption(), rangeTransDate.value())); if (qr.prompt() && element.prompt()) { while (qr.next()) { custTable = qr.get(tableNum(CustTable)); custTrans = qr.get(tableNum(CustTrans)); if (!custTable) { ret = false; break; } if (qr.changed(tableNum(custTable))) { element.send(custTable, 1); } if (qr.changed(tableNum(custTrans))) { element.send(custTrans, 2); } } ret = true; } else ret = false; return ret; }