Skip to main content

Posts

Showing posts from August, 2010

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(); }

DictTable example in axapta

This is sample code for DictTable example in axapta static void Job24(Args _args) { DictField df; extendedTypeId eti; DictType dt; date _date = 28\08\2008; ; df = new DictField(tablenum(Address), fieldnum(Address, AddrTableId)); info(strFmt('%1 %2', Year(_date), MthOfYr(_date) )); if (df) { eti = df.typeId(); if (0 != eti) { dt = new DictType(eti); if (dt) { print strfmt("The field is based on %1.", dt.name()); } } else { print "The field is not based on an extended data type."; } } pause; }

Export from custTable to Excel file in axapta

To Export Records from custTable to Excel  file in  axapta You can try following code. static void ExportingFields4mCustTable(Args _args) { CustTable CustTableLocal; SysExcelApplication excelApp; SysExcelWorkSheet excelWorksheet; SysExcelRange excelRange; SysExcelCells excelCells; SysExcelCell excelCell; ComVariant cellValue; Int i=1; ; excelApp = SysExcelApplication::construct(); cellValue = new ComVariant() ; excelApp.workbooks().add(); excelWorksheet = excelApp.worksheets().itemFromNum( 1 ); excelCells = excelWorksheet.cells(); while select * from CustTableLocal { excelCells.item(i+4,4).value(cellValue.bStr(CustTableLocal.AccountNum)); excelCells.item(i+4,5).value(cellValue.bStr(CustTableLocal.Name)); i++; } excelApp.visible(true); }

Create report runtime in axapta through code

This is code sample to Create report runtime in axapta through code static void MakeReportInJob(Args _args) { #AOT str reportName = 'aatestReport'; tableid custTableId = tablenum(CustTable); TreeNode reportNode = TreeNode::findNode(#ReportsPath); Report areport; ReportDesign design; ReportAutoDesignSpecs specs; ReportSection section; ReportRun run; ; // Delete the report if it already exists areport = reportNode.AOTfindChild(reportName); if (areport) areport.AOTdelete(); // Build the report areport = reportNode.AOTadd(reportName); areport.query().addDataSource(custTableId); design = areport.addDesign('Design'); specs = design.autoDesignSpecs(); section = specs.addSection(ReportBlockType::Body, custTableId); section.addControl(custTableId, fieldnum(CustTable, AccountNum)); section.addControl(custTableId, fieldnum(CustTable, Name)); // Now the report will not prompt for user input areport.inter

passing variable through form to report in axapta

This is a sample code for passing variable through form to report in axapta public void sumss() { str ss; int tmp; ; //Element.selectMode(Element.control(Control::Sunny_CustMaster_NO));; for (Table1 = Table1_ds.getFirst(true) ? Table1_ds.getFirst(true) : Table1_ds.cursor(); Table1; Table1 = Table1_ds.getnext()) { tmp = Table1.SrNo; } iss = num2str(tmp,2,2,4,2); } call on clicked event of button Args args = new Args(); ; for (Table1_obj1 = Table1_ds.getFirst(true) ? Table1_ds.getFirst(true) : Table1; Table1_obj1; Table1_obj1 = Table1_ds.getNext()) { args.record(Table1_obj1); element.sumss(); args.parm(iss); new MenuFunction(menuitemoutputstr(Traveling_Voucher), MenuItemType::Output).run(args); } super(); Pass to report like this super(); //psum = element.args().record(); // sumss = element.args().parm("acc"); iss = element.args().parm(); element.SumRes(iss); Table12 = element.args

Create user groups in Microsoft dynamics axapta

1. From an Microsoft Dynamics AX client, click Administration > Setup > User groups. 2. On the Groups tab, press CTRL+N to create a new group. 3. Enter an identification in the Group column (required). For example, Fin for Finance or HR for Human Resources. 4. Enter a name in the User group name column (required). For example Finance Department or Human Resources Department. 5. Click the Users tab. 6. Select users in the Remaining users list box and click the left-arrow button (<) to move the selected users into the Selected users list box. All users moved into the Selected users list box are added to the current group. 7. Press CTRL+S to save changes.

Steps to configuring IIS service manager

1. To open IIS Services Manager, click Start > All Programs > Administrative tools > Internet Information Services Manager. 2. In IIS Manager, navigate to the virtual root DynamicsWebService. 3. Click Action > Properties. 4. On the Directory tab, click Create. 5. Select the Application Pool created when you set up the application integration server. For additional information, see Install an application integration server. 6. For Execute permissions, select Scripts only. 7. Set the local path permissions to read by selecting the Read check box in the Local path section. 8. Navigate to Directory Security and clear Anonymous. Select Integrated. 9. On the ASP.NET tab, select ASP Version 2.0. If the ASP.NET tab does not appear, you must uninstall and reinstall ASP.NET in IIS using the following steps: a. Click Start > Run. b. Type cmd. c. In the Command Prompt window, type: cd your-system-directory\Microsoft.NET\Framework\v2.0.50727. and press ENTER.

select All Records Dynamically in axapta

This is sample code to select All Records Dynamically in axapta static void selectAllRecordsRuntimeArgs _args) { firstTable firstTable; DictField dictField; DictTable dictTable; int field; int fieldId; int records; str header, line; ; // Create a new object of type DictTable based on the firstTable dictTable = new DictTable(tablenum(firstTable)); // Loop through the fields on the table. // For each field, store the field-label in the header variable. for (field=1; field <= dictTable.fieldCnt(); field++) { fieldId = dictTable.fieldCnt2Id(field); dictField = new DictField(tablenum(firstTable), fieldId); header += strfmt("%1, ", dictField.label()); } info(strupr(header)); // strupr changes the string to UPPERCASE // Loop through all the records in the firstTable while select firstTable { line = ""; // For each record in the firstTable, loop through all the //fields // and store the value of the field

Steps to Creating a view in axapta

Steps to Creating a view in axapta  1. First, we locate the Views node under the Data Dictionary in the AOT. 2. Right-click on the Views node and select New View. A new view will be created. You can open its properties by right-clicking and selecting Properties. 3. Change the name of the view to firstCust second and give it a label that describes the contents of the view. 4. The views can actually use queries that have already been created as a base for the data selection. This is done in the Properties of the view by choosing the query from the Query property. However, in our example, we will create the view from scratch. 5. Under the Metadata node, right-click on the Data Sources node and select New Data Source 6. Select the newly created data source and enter firstTable in the table property. The name of the data source will automatically change to firstTable_1, which is normal. 7. Under the firstTable data source, find the Data Sources node, right-click on it, and select

Joining data sources in a query in axapta

Joining data sources in a query in axapta InnerJoin Will return the records where the joined data sources have matching values in the joined fields. For example: By using the firstTable as the primary data source and using secondTable as the joined data source, the inner join will fetch all records from the firstTable where there is a corresponding record in the secondTable. The corresponding records in secondTable will also be fetched. OuterJoin Will return all the records from the joined table even if they don't match the joined field. For example: Compared to the example using the InnerJoin, this will return all records from the firstTable, but also records from the secondTable that does not have a match in the firstTable. ExistsJoin This is just like the InnerJoin, except the records from the joined data source are not returned. They are only used to filter the primary data source. For example: In our example, it will only return records in the firstTable where there

How can we Delete duplicate records of table in axapta

delete duplicate in axapta .If there is duplicate record in table then use this job to delete duplicate. If two name like sks and sks then one will be delete and one will remain. static void deleteduplicate(Args _args) { Set fieldSet = new set(Types::Integer); // create dictindex from the unique index DictIndex dictIndex = new DictIndex( tablenum(_RegistrationDetails), indexnum(_RegistrationDetails, Index1)); ; // these are the fields from the index // add them to a set fieldSet.add(fieldnum(_RegistrationDetails, _RegistrationNo)); // fieldSet.add(fieldnum(YourTable, YourTableFieldId2)); // set allow duplicates ReleaseUpdateDB::indexAllowDup(dictIndex); // delete duplicate records ReleaseUpdateDB::deleteDuplicatesUsingIds(tablenum(_RegistrationDetails), 0, fieldSet); // reenable index ReleaseUpdateDB::indexAllowNoDup(dictIndex); info("done"); }

Keywords list for Axapta bloggers

Add date range value from dialog to report ,Add multiple range and multiple table lookup ,Add range ,add run time control in axapta ,BI Design Suite ,BI Design Suite integrates with Microsoft Dynamics AX. Logistica ,Call Import data file in button in axapta ,Call other for on button clicked event in axapta ,Check exist item validation in table using axapta ,code Bind user to particular office in axapta application ,Code to add dialog and get value from dialog box using Axapta . Create and delete folder using axapta x++ code ,create folder ,Create Graph and load data to graph using axapta ,create lookup runtime in axapta form ,Create Organization Chart in axapta ,datasource in axapta using code in report ,Delete_from command to delete from table in axapta ,Display data of particular division and circles and filter data separated by comma ,Division BI Design Suite integrates with Microsoft Dynamics AX. Logistica ,Example of Fetch Method in Axapta ,Fetch function in Microsoft Dynamics

Filter value in lookup in payment journal invoice id as per customer in invoice bill using axapta

Filter value in lookup in payment journal invoice id as per custmer in invoice bill public void lookup() { SysTableLookup tableLookup; QueryBuildRange rangeTransDate; QueryBuildRange VillageCode,ItemId,DistCode,TalukaCode; QueryBuildRange CropId; QueryRun queryRun; QueryBuildDataSource qbds,qbds1,qbr,qbr1,qbr2; Query q = new Query(); Query q1 = new Query(); QueryBuildLink QueryBuildLink1,QueryBuildLink2; boolean flg; ; tableLookup = SysTableLookup::newParameters(tableNum(CustInvoiceTable),this); qbr = q.addDataSource(tableNum(CustInvoiceTable)); if(LedgerJournalTrans_AccountNum.valueStr() != "" ) { qbr.addRange(fieldnum(CustInvoiceTable,InvoiceAccount)).value(queryValue(LedgerJournalTrans_AccountNum.valueStr())); } tableLookup.parmQuery(q); tableLookup.addLookupfield(fieldNum(CustInvoiceTable,InvoiceId)); tableLookup.performFormLookup(); }

create lookup runtime in axapta form

This is a sample code to create lookup runtime in axapta form public void lookup() { SysTableLookup tableLookup; QueryBuildDataSource qbds, qbds1; QueryBuildLink QueryBuildLink1; Query q = new Query(); ; tableLookup = SysTableLookup::newParameters(tableNum(_Taluka),this); qbds = q.addDataSource(tablenum(_Taluka)); qbds.addRange(fieldnum(_Taluka, _DistrictCd)).value(District.valueStr()); tableLookup.parmQuery(q); tableLookup.addLookupfield(fieldNum(_Taluka,_TalukaCd)); tableLookup.addLookupfield(fieldNum(_Taluka, _TalukaName)); tableLookup.performFormLookup(); }

Concatenating Query range values in form datasource using axapta

Taking value in range by concatenating values in form and use of data source in form public void insert_tmpVillage() { QueryBuildDataSource qbds, qbds1, qbdsid, qbdsid1; Query q = new Query(); Query qid = new Query(); QueryBuildLink QueryBuildLink1; QueryBuildLink QueryBuildLink2; queryRun queryRun1; queryRun queryRun2; _BlockVillage _BlockVillage1; str range; QueryBuildRange qbr; Query query; QueryRun qr; ; Office = _Block.Office; TechYear = _Block.Year; Crop = _Block.CropId; season = _Block.Season; if(District.valueStr() != '' && Taluka.valueStr() != '') { qbdsid = qid.addDataSource(tablenum(_Block)); qbdsid.addRange(fieldnum(_Block, Office)).value(Office); qbdsid.addRange(fieldnum(_Block, Year)).value(TechYear); qbdsid.addRange(fieldnum(_Block, CropId)).value(Crop); qbdsid.addRange(fieldnum(_Block, Season)).value(queryValue(season)); qbdsid1 = qbdsid.addDataSource(tablenum(_Bloc