Skip to main content

Posts

Fetch Method to make Trial balance quickly

This is simple Fetch Method to make Trial balance quickly. Some times standard trial balance does not match due to wrong customization of application so there may be data problem in ledger balance table then you can make trial balance by using LedgerTrans table. Performance of report will be slow but it can give accurate result. public boolean fetch() { Query q = new Query(); QueryBuildDataSource qbds; ; q= this.query(); qbds = q.dataSourceTable(tablenum(LedgerTrans)); qbds.addSortField(fieldnum(LedgerTrans,AccountNum)); rangeTransDate =qbds.findRange(fieldnum(LedgerTrans,TransDate)); purpose1 = qbds.findRange(FieldId2Ext(FieldNum(LedgerTrans, Dimension),3)); if(!rangeTransDate.value()) { rangeTransDate.value(queryRange(dateMin,dateMax)); fromdate= dateMin; todate =dateMax; } else { value=rangeTransDate.value(); if(strfind(value,".",1,11) != 0) { mindate1 =strdel(value,strfind(value,".",1,11),strle

strscan function to scan string characters in axapta

This is a sample of code how to use of strscan function in axapta to scan string from string. void ArrayAccount() { //s = ""; // len = strlen( _s ); // pos = strfind( _s, _delimeter, len, -len ); // s = strdel( _s, 0, pos ); cntAc =1; name = System.Convert::ToString(BHead); Accountname[cntAc] = LedgerTable::find(name).AccountName; len = strlen(name); for (i = 0; i<=len;i++) { pos = strscan( name, ".", strlen( name ), 0 - strlen( name ) ); fName = strdel( name, pos, strlen( name ) - pos + 1 ); lastName = strdel( name, 1, pos ); if (FName != "") { name = fName; cntAc++; Accountname[cntAc] = LedgerTable::find(name).AccountName; } } }

Add date range value from dialog to report through code in Axapta

This is a sample code to Add date range value from dialog to report through code in Axapta. This code is to use in report of Ax. Getfromdialog and dialog is overridden method in Ax report. public boolean getFromDialog() { ; cmbOfficeCode = dialogOffice.value(); // cmbProjId = dialogProjId.value(); DateType = dialogDateType.value(); fromdate = dialogfromdate.value(); todate = dialogtodate.value(); return true; } public Object dialog(Object _dialog) { DialogRunbase dialog = _dialog; ; cmbOfficeCode = InventId; cmbProjId = ProjId1; dialogOffice = dialog.addFieldValue(typeid(InventLocationId), cmbOfficeCode); //dialogProjId = dialog.addFieldValue(typeid(ProjId), cmbProjId); dialogDateType = dialog.addFieldValue(typeid(Irrigation_Date),"Select Date", "Select Date"); dialogFromDate = dialog.addFieldValue(typeid(FromDate), fromDate); dialogToDate = dialog.addFieldValue(typeid(ToDate), toDate); return dialo

Create Organization hierarchy Chart in axapta

These are method to create organization hierarchy chart in Axapta public class FormRun extends ObjectRun { CCFormTreeDatasource treeDatasource; } void InsertinTemp() { TmpOrganizationChart2 TmpOrganizationChart2_1; _OrganizationChart2 _OrganizationChart2_1; ; /*hile select _OrganizationChart2_1 { while select forupdate TmpOrganizationChart2_1 where TmpOrganizationChart2_1.WareHouseCode==_OrganizationChart2_1.WareHouseCode { TmpOrganizationChart2_1.delete(); } }*/ Delete_from TmpOrganizationChart2_1; While select _OrganizationChart2_1 { TmpOrganizationChart2_1.WareHouseCode=_OrganizationChart2_1.WareHouseCode; TmpOrganizationChart2_1.ParentWareHouseCode=_OrganizationChart2_1.ParentWareHouseCode; TmpOrganizationChart2_1.Office_type=_OrganizationChart2_1.Office_type; TmpOrganizationChart2_1.Name=InventLocation::find(_OrganizationChart2_1.WareHouseCode).Name; TmpOrganizationChart2_1.insert(); } } public void

Load data to chart in axapta

If you want to Load data to show as a  chart in axapta then you need to drag chart control to form group or tab then you can store data in to tables. You can use while loop to take data in looping and at the time of loop execution you can call data to graph. This is a simple method which you can call on init method of form to show data initially. void createGraph() { //SalesLine salesline; // graphics graphics,graphics1; int i,k; str month; // date createddate; #macrolib.ChartFx ; graphics1 = Graphics::newGraphicsTitlesLayout(ChartX, 100, 200,'Title', 'X', 'Y', 'z',1 ,1, 1, 1); graphics1.create(); graphics1.parmTitle(""); graphics1.parmTitleXAxis('Year'); graphics1.parmTitleYAxis('Weight(Kg.)'); ChartX.Chart3D(true); ChartX.toolBar(true); //graphics.Gallery(9); ChartX.Gallery(6); ChartX.DataEditor(true); ChartX.grid(1); ChartX.BackColor(16777215); ChartX.ToolBa

Use temporary variable to distinct or group by element to fetch record in Axapta

Fetch method is override method of report in axapta. You can Use temporary variable to distinct or group by element to fetch record in Axapta . By this example you can get only hints or idea to use in your report. public boolean fetch() { Query q = new Query(); QueryBuildDataSource qbds; ; q= this.query(); qbds = q.dataSourceTable(tablenum(LedgerTrans)); // qbds = q.addDataSource() qbds.addSortField(fieldnum(LedgerTrans,AccountNum)); rangeTransDate =qbds.findRange(fieldnum(LedgerTrans,TransDate)); purpose1 = qbds.findRange(FieldId2Ext(FieldNum(LedgerTrans, Dimension),3)); if(!rangeTransDate.value()) { rangeTransDate.value(queryRange(dateMin,dateMax)); fromdate= dateMin; todate =dateMax; } else { value=rangeTransDate.value(); if(strfind(value,".",1,11) != 0) { mindate1 =strdel(value,strfind(value,".",1,11),strlen(value)); maxdate1 =strDel(value,strfind(value,".",1,11)+1,-(strfind(val

Use multiple table link through code in Axapta report

public boolean fetch() { str 50 tmpregno; QueryBuildDataSource qbds,qbds1,qbds2; QueryBuildRange queryBuildRange; QueryBuildRange rangeTransDate; QueryRun qr1; QueryBuildLink QueryBuildLink_1; query q = new Query(); query q1 = new Query(); ; // frmdt = str2date("01/05/2010",123); // todt = str2date("30/05/2010",123); q = this.query(); q1 = this.query(); qbds2 = q.addDataSource(tablenum(_Registration)); qbds1 = qbds2.addDataSource(tablenum(_RegistrationDetails)); qbds = qbds1.addDataSource(tablenum(_Register4)); qbds.joinMode(JoinMode::InnerJoin); QueryBuildLink_1 = qbds.addLink(fieldNum(_RegistrationDetails, _RegistrationNo), fieldNum(_Register4, RegistrationNo)); qbds.relations(true); queryBuildRange = qbds.addRange(fieldNum(_Register4, ProcessDate)); rangeTransDate = qbds.findRange(fieldnum(_Register4,ProcessDate)); /* if(!rangeTransDate.value()) { rangeTransDate.value(queryRange(dateMin,dateMax)); if (dateMin ==str2date(