Skip to main content

Posts

Showing posts with the label strfmt

Code to get Miscellaneous charges of purchase line in Ax 2012

This is Code to get Miscellaneous charges of purchase line in Ax 2012. You can try below code to check in job. PurchTable purchTable; PurchLine purchLine; MarkupTrans markupTrans; while select * from purchLine Join purchTable Join markupTrans Where purchTable.PurchId == purchLine.PurchId && markupTrans.TransRecId == purchLine.RecId && purchTable.PurchId=="PO-0000043" { info(strFmt("%1 , %2 , %3",purchLine.PurchId,markupTrans.Txt,markupTrans.Value)); }

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

How to Update Project Status by Code in Ax 2012

To Update Project Status by Code in Ax 2012 You can get help from below code sample. In this code if Project status is created then it will update to In process stage. Same way you can try as per your requirement. Projtable projTable; int cnt; ttsBegin; while select forUpdate projtable where projTable.Status==ProjStatus::Created { cnt++; projtable.Status=ProjStatus::InProcess; projtable.update(); } ttsCommit; info(strFmt("%1 Project Updated",cnt));

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

How to get AOT element in current layer by code in axapta

To get AOT element in current layer by code in axapta you can  get help from below code. You can get other layer element by change enum value of utillevel. UtilElements _UtilElements; while select _UtilElements where _UtilElements.recordType == UtilElementType::ExtendedType && _UtilElements.utilLevel == global::currentAOLayer() { info(strfmt("%1",_UtilElements.name)) ; }

Left Outer Join in Ax 2012

You can use Left Outer Join in Ax 2012 following way. There is no Right Outer join  in Ax 2012. Default outer joint is left outer join so there is not left keyword is used in query. while select AccountNum from LedgerTable order by AccountNum outer join * from LedgerTrans where LedgerTrans.AccountNum == LedgerTable.AccountNum { info(strfmt("%1-%2", LedgerTable.AccountNum, LedgerTrans.AmountMst)); }