Monday, September 12, 2016

Dimension Combination Field enable based On Dimension selection Hirerarchy ax 2012

//Dimension Combination Field enable based ax 2012

public void displayDimensionAttributeValueColumns()
{
    int                     i,levelCount;
    FormStringControl       dimensionFormControl;
    DimensionSetSegmentName dimensionSetSegmentNames;
    if (DisplaySeparateDimensionValues.value())
    {
        DimensionAttributeValueCombination_DisplayValue.visible(false);
        dimensionSetSegmentNames = DimensionHierarchyLevel::getDimensionHierarchyLevelNames(dimHier.RecId);
       levelCount = DimensionHierarchy::getLevelCount(dimHier.RecId);
        for (i = 1; i <= #MaxDimensionHierarchyLevelsInStructure; i++)
        {
            if (i <= levelCount)
            {
                dimensionFormControl = this.getDimensionAttributeControl(i);
                dimensionFormControl.label(dimensionSetSegmentNames[i]);
                dimensionFormControl.visible(true);
            }
            else
            {
                dimensionFormControl = this.getDimensionAttributeControl(i);
                dimensionFormControl.visible(false);
            }
        }
    }
    else
    {
        DimensionAttributeValueCombination_DisplayValue.visible(true);
        for (i = 1; i <= #MaxDimensionHierarchyLevelsInStructure; i++)
        {
            dimensionFormControl = this.getDimensionAttributeControl(i);
            dimensionFormControl.visible(false);
        }
    }
}

private FormStringControl getDimensionAttributeControl(int _Level)
{
    if (_Level <= 9)
    {
        return element.design().controlName(strFmt('Dimensionocom0%1', _Level));
    }
    else
    {
        return element.design().controlName(strFmt('Dimensioncom%1', _Level));
    }
}

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...