Tuesday, March 20, 2018

X++ code to get the individual dimension values from default dimension in D365


public static DimensionDefault  getDefaultDimBranchValues(DimensionValue "",DimensionValue "",DimensionValue "",DimensionValue    "")
{
        DimensionDefault            defaultDimension,result;
        container                   conAttr,conValue;
        str                         dimValue;
        int             counttrans,j;
        DimensionAttribute          dimensionAttribute;
        DimensionAttributeValue     dimensionAttributeValue;
        DimensionAttributeValueSetStorage valueSetStorage        = new DimensionAttributeValueSetStorage();
        conAttr  = ["DimensionName","DimensionName","DimensionName","DimensionName"];
        conValue = [DimensionValue,DimensionValue,DimensionValue,_reDimensionValueorting,DimensionValue];

        for (j = 1; j <= conLen(conAttr); j++)
        {
            dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,j));
      
            if (dimensionAttribute.RecId == 0)
            {
                continue;
            }
      
            dimValue = conPeek(conValue,j);
      
            if (dimValue != "")
            {
                dimensionAttributeValue =dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
                valueSetStorage.addItem(dimensionAttributeValue);
            }
        }
        result = valueSetStorage.save();
        return result;
}

2 comments:



  1. I'm here to share my testimony of what a good trusted loan company did for me, I'm from Russian and I’m a lovely mother of 3 kids I lost my funds on trying to get a loan to expand my evergreen group company it was so hard for me and my children, I went online to seek for a loan assistance all hope was lost until one fateful day when I met this friend of mine who recently secured a loan from a very honest man Mr, Pedro. She introduced me to this honest loan officer, Mr. Pedro, who helped me get a loan within 5 working days, I will forever be grateful to Mr Pedro, for helping me get back on my feet again. You can contact Mr Pedro via email: pedroloanss@gmail.com / WhatsApp: +18632310632 they do not know I’m doing this for them, but i just have to do it because a lot of people are out there who are in need of loan assistance please come to this honest man and you can be safe as well.

    ReplyDelete