Skip to main content

Posts

Showing posts with the label AX 2012

Code Sample to Export Assets Master Table Value to CSV in Axapta

This Code Sample to Export Assets Master Table Value to CSV in Axapta. You can take many columns and value from table . This is just an example. Query q; QueryBuildDataSource qbds; QueryBuildRange qbr; QueryRun qr; CommaIO commaIO; FileName fileName; InventTable inventTable; AssetTable AssetTable; ; fileName = "C:\\TestSupport\\" + "ItemDetails1" + ".csv"; //Destination of the file commaIO = new CommaIO(fileName,'W'); q = new Query(); qbds = q.addDataSource(tablenum(AssetTable)); qbr = qbds.addRange(fieldnum(AssetTable,Assetid)); //Range qr = new QueryRun(q); commaIO.write("ItemId","Item Type"); //Header of the CSV File //Loop to insert values in the csv from the table while( qr.next() ) { AssetTable = qr.get(tablenum(AssetTable)); commaIO.write(AssetTable.AssetId,enum2str(AssetTable.AssetType)); break; } WINAPI::shellExecute(fileName);

How to Filter Records in form from Combo box in Axapta

Lets you want to to Filter Records in form from Combo box in Axapta then this is sample example you need to create one method like this. WMSPickingRoute_ds.filter(fieldNum(WMSPickingRoute,ExpeditionStatus),queryValue(God_expeditionStatus.selection())); Then you can call that method in modified field method for that combo box. Like filter1 is method name then you can call it below way. public boolean modified() { boolean ret; ret = super(); this.filter1(); return ret; } I hope you get and Idea how to filter records for form in axapta.

Code to get Employee Name For all employee in Ax 2012

 To get Employee Name For all employee in Ax 2012 You can get idea from below code. DirPerson dirPerson; HcmWorker hcmWorker; HRMDailyAttendance hrmDailyAttendence; ; while select Name ,gender from dirPerson join hcmWorker group by dirPerson.Name,dirPerson.Gender where hcmWorker.Person == dirPerson.RecId { info(strFmt("%1",dirPerson.Name)); }

Get total number of records for all table and synchronization tips in Ax 2012

To Get total number of records from all table and Export data  into excel in Axapta 2012 you can apply below tips. Go to AOT(CTR+D)->Tool->Number of Records to bring in excel select all  records then press Control +T key You can get exact steps from below video clips. To Reindex and synchronize table from Microsoft Dynamics Axapta You can apply below tips System administration -Periodic-Database -SQL Administration To get exact step see below clips. You can subscribe to get more updates.

How to find BOM Unit and Inventory Unit for item in Ax 2012

To find BOM Unit and Inventory Unit for item you can get idea from below code sample.This code you can try in your job code editor in axapta. InventTable inventTable; InventUnitId inventoryUnit,BOMUnit; BOM bom; ItemId curItem; ; while select BOM order by itemid where BOM.BOMQty { if(curItem != BOM.ItemId) { curItem = BOM.ItemId; inventTable = InventTable::find(bom.ItemId); inventoryUnit = inventTable.InventUnitId(); BOMUnit = bom.UnitId; if(!UnitOfMeasureConverter::canBeConverted(UnitOfMeasure::findBySymbol(inventoryUnit).RecId, UnitOfMeasure::findBySymbol(BOMUnit).RecId, inventTable.Product)) { if(inventoryUnit != BOMUnit) { info(strFmt("item %1 has bom unit %2, inventory unit %3",inventTable.itemId,BOMUnit,inventoryUnit)); } } }

Backdate validation for user control in EP MSD axapta

If you are seeking code for Backdate validation for user control in Enterprise portal page for  axapta then below code can help you. Its tricky to find code on EP so its helpful for you. string cDate1 = DateTime.Now.ToString("dd/MM/yyyy"); int flag = 0; Proxy.Info objinfolog = new Proxy.Info(this.AxSession.AxaptaAdapter); DateTime x; DateTime a; Int32 r1; Date1 = txtDate1.Text; Ir = dsTestNewForm.GetDataSourceView("TestNewForm").DataSetView.GetCurrent().GetRecord(); if (txtDate1.Text != "" && Ir.GetField("Date1").ToString() == "1/1/1900 12:00:00 AM") { x = DateTime.Parse(cDate1, new CultureInfo("en-CA")); a = DateTime.Parse(Date1, new CultureInfo("en-CA")); r1 = DateTime.Compare(a, x); if (Ir.GetField("Date1").ToString() == "1/1/1900 12:00:00 AM" && r1 < 0 && Date1 != "")

How to use financial Dimension technically in MSD AX 2012

a. Open AOT>>Data Dictionary>>Extended Data Types type/select Dimension Default and drag it in table which will be used further as a data source in form where you have to show the Dimensions. Do Remember  that you have to drag it in table not at Data Source. b .Open Table in the Data, Dictionary which will be used as a Data source, and create a relation with table DimensionAttributeValueSet . c .Right Click the Relations. Select ‘New Realation’.  Select properties. Set name as DimensionAttributeValueSet, Table as DimensionAttributeValueSet. d. Right Click the this newly created Relation DimensionAttributeValueSet, select New>>Normal. e. Set the properties of Normal Relation as:  Field=TheFieldwhichwillsaveDimensionNumberInYourTable Source EDT= DimensionDefault Related Field=RecId 2.Verify that the table that will hold the foreign key to the DimensionAttributeValueSet table is a data source on the form(the one on which you have to show dimensions