Skip to main content

Posts

Adding Progress bar in form or report in axapta

Adding Progress bar in form or report in axapta is not so tough I just try this code. SysOperationProgress progress,progressexcel; str tmpb,tmpogroup,tmpo,tmpb; ; progressexcel = new SysOperationProgress(); progressexcel.setCaption('Progress'); progressexcel.setText('Printing To Excel..Please Wait'); super(); startLengthyOperation(); element.oQuery(); element.close(); progressexcel.setTotal(8000); excelApplication = new COM("excel.application"); excelWorkBooks = excelApplication.workBooks(); excelWorkBook = excelWorkBooks.add(); excelWorkSheets = excelWorkBook.worksheets(); excelApplication.visible(false); excelWorkSheet = excelApplication.activeSheet(); styles = excelWorkBook.styles(); style = styles.add('MyStyle'); font = style.font(); font.bold(true); range = excelWorkSheet.Range("A1:C1"); range.style('MyStyle'); range.MergeCells(true); range.value2(CompanyI

How to concatenate multiple range from projTable

How to concatenate multiple range from projTable. Just use simple code here. static void concatenatemultipleRange(Args _args) { ProjTable ProjTable1; QueryBuildDataSource qbds; Query q = new Query(); queryRun queryRun1; str range; str 20 InventId; ProjTable ProjTable2; QueryBuildDataSource qbds1; Query q1 = new Query(); queryRun queryRun2; ProjTable ProjTable3; QueryBuildDataSource qbds2; Query q2 = new Query(); queryRun queryRun3; date startdate; ; startdate = str2date('31/07/2010',123); range = ''; q = new Query(); qbds = q.addDataSource(tablenum(ProjTable)); // dimensionRange = ProjTable_ds.query().dataSourceTable(TableNum(ProjTable)).addRange(FieldId2Ext(FieldNum(ProjTable, Dimension),2)); qbds.addRange(FieldId2Ext(FieldNum(ProjTable, Dimension),2)).value(''); qbds.addRange(fieldNum(ProjTable, Created)).value(strFmt('((Created >= %1)', date2StrXpp(startdate))); qbds.add

Use of Switch case and add data field to grid at runtime

Use of Switch case and add data field to grid at runtime. public void Bind_Total() { FormControl FC1, FC2, FC3, FC4, FC5, FC6, FC7; delete_from SD_AllDetails_Total; select sum(NoofSP), sum(Area), sum(ApproxYield), sum(ActualYield), sum(NoLot), from SD_AllDetails_1; SD_AllDetails_Total1.NoofSP = SD_AllDetails_1.NoofSP; SD_AllDetails_Total1.Area = SD_AllDetails_1.Area; SD_AllDetails_Total1.ApproxYield = SD_AllDetails_1.ApproxYield; SD_AllDetails_Total1.ActualYield = SD_AllDetails_1.ActualYield; SD_AllDetails_Total1.NoLot = SD_AllDetails_1.NoLot; SD_AllDetails_Total1.insert(); SD_AllDetails_Total_ds.refresh(); SD_AllDetails_Total_ds.reread(); SD_AllDetails_Total_ds.research(); GridTotal = GroupTotal.addControl(FormControlType::Grid, "GridTotal", StaticText); GridTotal.dataSource(SD_AllDetails_Total_ds.id()); while select * from SD_Columns3 order by SD_Columns3.ID where SD_Columns3.YesNo == true && SD_Columns3.GroupBy == false { switch(SD_Co

Add range in job using axapta

Add range in job using axapta static void JobForRangeInAx(Args _args) { // variable declaration str string; Query query; QueryRun queryRun; QueryBuildDataSource queryBuildDataSource; QueryBuildRange queryBuildRange; CustTable custTable; ; //start logic of program if ( hasSecurityKeyAccess(securityKeyNum(SysDevelopment), AccessType::Edit) ) { query = new Query(); queryBuildDataSource = query.addDataSource(TableNum(CustTable)); queryBuildRange = queryBuildDataSource.addRange(FieldNum(CustTable,AccountNum)); queryBuildRange.value("1000..2000"); queryRun = new queryRun(query); if (queryRun.prompt()) { while (queryRun.next()) { custTable = queryRun.get(TableNum(CustTable)); print custTable.AccountNum; } } } select count(Name) from custTable; string = custTable.Name; Box::info(string,'title','help'); }

Add a form list control. in form at runtime using axapta

Add a form list control. in form at runtime using axapta static void createForm2(Args _args) { Args args; Form form; FormRun formRun; FormBuildDesign formBuildDesign; FormBuildDataSource formBuildDataSource; FormBuildListControl formBuildListControl; FormListControl formListControl; FormListItem formListItem; FormListColumn formListColumn1; FormListColumn formListColumn2; FormListColumn formListColumn; DictTable dictTable; int idx4; str string; container conAccountNum; CustTable custTable; int numAccounts; int i; int item; int numItems; ; // Create the form header. form = new Form(); // Add data sources to the form. dictTable = new DictTable(tableNum(custTable)); formBuildDataSource = form.addDataSource(dictTable.name()); formBuildDataSource.table(dictTable.id()); // Create the form design. formBuildDesign = form.addDesign("Design"); formBuildDesign.caption("myForm"); // Add a form list control. formBuildListControl = formB

Use of query build datasource in job and range

Use of query build datasource in job and range static void SelectCustomerJobQuery(Args _args) { Query query; QueryBuildDataSource queryBuildDatasource; QueryBuildRange queryBuildRange; QueryRun queryRun; Counter recordsFound; custTable cust; ; query = new Query(); queryBuildDataSource =query.addDataSource(tableNum(custTable)); queryBuildDataSource.addSortField(fieldNum(custTable,Name)); queryBuildRange =queryBuildDataSource.addRange(fieldNum(custTable,city)); queryRun = new QueryRun(query); /*while (queryRun.next()) { cust= queryRun.get(tablenum(custTable)); print cust.Name; }*/ if (queryRun.prompt()) { while (queryRun.next()) { recordsFound++; cust= queryRun.get(tablenum(custTable)); print cust.Name; } } info(strFmt("Customers found: %1", recordsFound)); pause; }

Print Report to PDF in axapta

Print Report to PDF in axapta static void printToPDF(Args _args) { Args args; ReportRun rr; str reportName = 'ReportName1'; ; args = new Args(reportName); rr = new ReportRun(args,''); rr.setTarget(Printmedium::File); rr.printJobSettings().format(PrintFormat::PDF); rr.printJobSettings().fileName("C:\\Cust_ReportRange.pdf"); rr.printJobSettings().allPages(false); rr.printJobSettings().from(2); rr.printJobSettings().to(4); // Disables forms that enable users to modify // the report query and print settings. rr.query().interactive(false); rr.report().interactive(false); rr.run(); }