Skip to main content

Posts

Code to Read Html File in MSD Axapta

Follow code is to Read from html file using Axapta x++. str page; str filename; commaIO myfile; int handle; WinInet _WinInet = new WinInet(); ; filename = "C:\\HTMLfl.txt"; myfile = new commaIO(filename,"w"); handle = _WinInet.internetOpenUrl('http://www.test.com'); if (handle) { page = _WinInet.internetReadFile(handle); myfile.write(page); } _WinInet.internetCloseHandle(handle);

Code to get Sales and purchase Quantity and amount date and item wise in MSD Axapta

To  get Sales and purchase Quantity and amount date wise in Axapta you can try following code in Fetch method of customized Report to get the same. Query q; QueryRun qr; QueryBuildDatasource qbds; QueryBuildRange qbr; InventTable inventtab; CustInvoiceTrans _custInvoiceTrans; vendInvoiceTrans _vendInvoiceTrans ; q = this.Query(); qbds = q.addDataSource(tablenum(InventTable)); qr = new QueryRun(q); while(qr.next()) { inventtable = qr.get(tableNum(InventTable)); select sum(Qty),sum(LineAmount) from _vendInvoiceTrans where _vendInvoiceTrans.ItemId==_ItemId &&_vendInvoiceTrans.InvoiceDate >= fromDate &&_vendInvoiceTrans.InvoiceDate <= ToDate; _PurchQty=_vendInvoiceTrans.Qty; _PurchAmount=_vendInvoiceTrans.LineAmount; select sum(Qty),sum(LineAmount) from _CustInvoiceTrans where _CustInvoiceTrans.ItemId==_ItemId &&_CustInvoiceTrans.InvoiceDate >= fromDate &&_CustInvoiceTrans.InvoiceDate <= ToD

Example of Fetch method of report using query build data source in MSD axapta

This is a code to get details of table data which is added to report data source. You can add following code in fetch method of report to check how to get value of data you can add range in data source and get the filtered records from report. Query q; QueryRun qr; QueryBuildDatasource qbds; QueryBuildRange qbr; ; q = this.Query(); qr = new QueryRun(q); QBDS = QR.query().dataSourceNo(1); while(qr.next()) { inventtable = qr.get(tableNum(InventTable)); info(inventtable.ItemGroupId); }

Example of doupdate in MSD axapta

To update records forcefully in table you can use doupdate method with tablename. Following example is helpful to understand this thing . InventTrans _inventTrans; ; ttsbegin; while select forupdate _inventTrans where _inventTrans.RecId == 5637152999 { _inventTrans.inventDimId = '123213'; _inventTrans.doUpdate(); } ttscommit;

Code Execute AIF Batch Job in MSD axapta

You can Execute AIF Batch Job in axapta just you need to paste following code to check for the same. AifInboundProcessingService _AifInboundProcessingService = new AifInboundProcessingService(); AifOutboundProcessingService _AifOutboundProcessingService = new AifOutboundProcessingService(); AIFGatewaySendService _AIFGatewaySendService = new AIFGatewaySendService(); AIFGatewayReceiveService _AIFGatewayReceiveService = new AIFGatewayReceiveService(); ; _AIFGatewayReceiveService.run(); _AifInboundProcessingService.run(); _AifOutboundProcessingService.run(); _AIFGatewaySendService.run();