Skip to main content

Posts

create dialog in class of axapta

This code is to create dialog in class using axapta code . Mostly new developer directly call dialog through report but by using class you can use to lot of report. DialogField DialogFromDate,DialogToDate; // DateTimeUtil fromDate; // DateTimeUtil toDate; FromDate fromDate; ToDate toDate; DateTimeAccepted tmpdate; protected Object dialog() { Object ret; DialogRunbase dialog; //= super(); ; Dialog = super(dialog); Dialog.caption("Percentage Calculation"); DialogFromDate = dialog.addField(typeid(FromDate)); DialogToDate = dialog.addField(typeid(ToDate)); return dialog; } public boolean getFromDialog() { boolean ret; ret = super(); fromDate=dialogFromDate.value(); toDate=dialogToDate.value(); return ret; } public container pack() { container ret; // ret = super(); return ret; } public boolean unpack(container packedClass) { boolean ret; ret = super(packedClass); return re

Date to datetime conversion in axapta

This code is Date to datetime conversion in axapta. Try this way. date fromDate ; Timezone timezone = DateTimeUtil::getUserPreferredTimeZone(); ; fromDate=mkdate(1,mthofyr(str2date('1/9/2009',123)),Year(str2date('1/9/2009',123))); abc.DateTime1>= datetobeginUtcDateTime(fromDate,timezone)

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