Monday, July 9, 2018

To Get configured Account Structure Data from Dynamics AX

//Getting configured Account Structure Data from dynamics AX

static void DimensionHierarchy(Args _args)
{
    DimensionHierarchyLevel             dimHierarchyLevel;
    DimensionAttribute                  dimAttribute;
    DimensionConstraintNode             dimConstraintNode;
    DimensionConstraintNodeCriteria     dimConstraintNodeCriteria;
    DimensionHierarchy                  dimHierarchy;
    str      60                         _dimHierarchy = "<Account structure name>";
    ;
    setPrefix("");
    while select RecId from dimHierarchy
            where dimHierarchy.Name == _dimHierarchy
            join RecId from dimHierarchyLevel
                where dimHierarchyLevel.DimensionHierarchy == dimHierarchy.RecId
                    join Name from dimAttribute
                        where dimAttribute.RecId == dimHierarchyLevel.DimensionAttribute
                            join RecId from dimConstraintNode
                                order by dimConstraintNode.Ordinal
                                    where dimConstraintNode.DimensionHierarchyLevel == dimHierarchyLevel.RecId
                                        join dimConstraintNodeCriteria
                                            where dimConstraintNodeCriteria.DimensionConstraintNode == dimConstraintNode.RecId
    {
        info(strFmt("%1 | From- %2 | To- %3",
                dimAttribute.Name,
                dimConstraintNodeCriteria.RangeFrom,
                dimConstraintNodeCriteria.RangeTo
                ));
    }
}

Referencehttps://sangeethwiki.blogspot.com/2017/10/ledger-and-default-dimension.html

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...