Skip to main content

Get Dimension Value from ledger dimesion through X++ AX 2012 R3

static void getDimValue(Args _args)
{
str 30 finMainaccount, finArea, finBussiness, fnCostCenter, finFamily, finSeason, finProject, finCompany;
DimensionAttributeLevelValueAllView dimAttrView; //View that will display all values for ledger dimensions
    DimensionAttribute                  dimAttr; //Main dimension attribute table
    int i;

        i++;


        while select DisplayValue from dimAttrView
            where dimAttrView.ValueCombinationRecId == generalJournalAccountEntry.LedgerDimension
            join Name from dimAttr
                where dimAttr.RecId == dimAttrView.DimensionAttribute
        {
            switch (dimAttr.Name)
            {
                case "MainAccount":
                    finMainaccount = strFmt(dimAttrView.DisplayValue);
                    break;

                case "Area":
                    finArea  = dimAttrView.DisplayValue;
                    break;

                case "CostCenter":
                    fnCostCenter =  dimAttrView.DisplayValue;
                    break;

                case "Family":
                    finFamily = dimAttrView.DisplayValue;
                    break;

                case "Business":
                    finBussiness =  dimAttrView.DisplayValue;
                    break;

                case "Project":
                    finProject = dimAttrView.DisplayValue;
                    break;

                case "Season":
                    finSeason =  dimAttrView.DisplayValue;
                    break;

                case "Company":
                    finCompany = dimAttrView.DisplayValue;
                    break;
            }
     }
}

Comments

Popular posts from this blog

How to change client Language in ax 2012

Hello,  As you know that Dynmics Ax run on different languages. So I gonna tell you how to change client language country/region specific. this is nothing but a very simple step to do. Go To > File > Tools > Options > After that go to General tab and select the language which you want to use in your client. then apply and exit. In my case I was using Arabic language. Now restart your client and see the difference. You can do it from your database also . Go to Database server  . In my case it is sql server 2014. Select your database > tables > UserInfo > select the user > change the language code. Done Thanks.

Simple x++ query with enum value range

static void queryEnumValue(Args _args) {     Query                   query;     QueryRun                queryrun;     QueryBuildDataSource    qbds;     QueryBuildRange         qbr;     PurchTable              purchTable;     ;         query = new Query();         qbds = query.addDataSource(tableNum(PurchTable));     qbds.addSortField(fieldNum(PurchTable, PurchId), SortOrder::Ascending);     qbr     = qbds.addRange(fieldNum(PurchTable, PurchStatus));         qbr.value(enum2str(PurchStatus::Received));         queryrun = new QueryRun(query);         while(queryrun.next())     {         purchTable = query...

Unit Conversion by code in ax 2012 R3 , X++

static void unitConversion() {     SysExcelApplication xlsApplication;     SysExcelWorkBooks xlsWorkBookCollection;     SysExcelWorkBook xlsWorkBook;     SysExcelWorksheets xlsWorkSheetCollection;     SysExcelWorksheet xlsWorkSheet;     SysExcelRange xlsRange;     SysExcelCells Cells;     SysExcelCell RCell;     CommaIO inFile;     int nRow,i;     DialogField dialogPath;     Dialog dialog;     Filename filename;         UnitOfMeasureConversion             unitOfMeasureConversion;     UnitOfMeasure                       unitOfMeasure;     EcoResProduct                       ecoResProduct;     RecId               ...