Skip to main content

Posts

Showing posts with the label name

How to get all Columns of Table in ax 2012 by job x++ code

To get all Columns of Table in ax 2012 by job x++ code you can try below code . If you table have large number of columns and do not have much time then you can use this job to get all columns to use in your code. This job can be very useful for your development. DictTable dictTable = new sysDictTable(tableNum(testTable)); fieldId fieldId=dictTable.fieldNext(0); dictField dictField; while(fieldId) { dictField=dictTable.fieldObject(fieldId); info(strFmt('testTable.%1 = %2;', dictField.name(), any2str(""))); fieldId= dictTable.fieldNext(fieldId); }

Remove spaces from Text in Ax 2012

To Remove spaces from Text you can get idea from below code sample. Here we are update name fields which include spaces on right and left side . Dirpartytable Dirpartytable; Name Name; ; while select forUpdate Dirpartytable { ttsBegin; Name= strRTrim(strLTrim(Dirpartytable.Name)); Dirpartytable.Name = Name; Dirpartytable.doUpdate(); ttsCommit; } info("Done");

Find Ledger Account Id by Ledger dimension in Ax 2012

To Find Ledger Account Id by Ledger dimension in Ax 2012 you can get hint from below code. findByLedgerDimension is a method defined in Mainaccount table where you can pass ledgerdimension value . MainAccountId is field name which is created in MainAccount Table. MainAccount Table is main master table for Ledgers. info(strFmt("%1",MainAccount::findByLedgerDimension(3427167077).MainAccountId));

Code to Get dimension description and value in ax 2012

This is hints of Code to Get dimension description and value in ax 2012. I have taken example of purchase order to show by selection first line of purchase line dimension value and description. PurchLine _purchLine; DimensionValue _Dimvalue; Description _Dimdesc; ; select firstonly _purchLine; _Dimvalue= dimValue(_purchLine.DefaultDimension, 'Department'); _Dimdesc = dimDesc(s_purchLine.DefaultDimension, 'Department'); info(strfmt("%1: %2", _Dimvalue, _Dimdesc));