Kamis, 13 November 2014

Financial Dimension AX 2012

Selama ini ane dibuat bingung dengan behavior nya Financial Dimension AX 12...
Ada beberapa table yang saling berkaitan.

Tapi akhirnya Alhamdulillah ane dah nemu code yang bisa membaca komponen Financial Dimension di AX 12.

berikut Kodenya ;

static void ShowVendDefaultDimensions(Args _args)
{
    VendTable                       vendTable;
    DimensionAttributeValueSet      dimAttrValueSet;
    DimensionAttributeValueSetItem  dimAttrValueSetItem;
    DimensionAttributeValue         dimAttrValue;
    DimensionAttribute              dimAttr;
    Common                          dimensionValueEntity;
    ;
    
    // Find our supplier
    vendTable = VendTable::find('3008');
    
    // Find the dimension value set that the vendor points to (for specifying the 
    // 'default' dimensions). This table is used as a sort of 'header' that the 
    // value set items (DimensionAttributeValueSetItem) records belong to.
    dimAttrValueSet = DimensionAttributeValueSet::find(vendTable.DefaultDimension);

    // Find all of the 'value set items' linked against the 'value set'  
    while select dimAttrValueSetItem
        where   dimAttrValueSetItem.DimensionAttributeValueSet   == dimAttrValueSet.RecId
    {
        // Find the dimension 'value' (DimensionAttributeValue) that the set item points to.        
        dimAttrValue        = DimensionAttributeValue::find(dimAttrValueSetItem.DimensionAttributeValue);
        
        // Find the underlying attribute.
        dimAttr             = DimensionAttribute::find(dimAttrValue.DimensionAttribute);

        // Use the helper class to obtain a reference to the underlying entity (can be anything)              
        dimensionValueEntity = DimensionDefaultingControllerBase::findBackingEntityInstance(
            curext(),
            dimAttr,
            dimAttrValue.EntityInstance);
        
        info(dimAttr.Name + ' ' + dimAttrValue.getValue());               
    }
}
 
lebih lengkapnya ada disini :
http://axinternals.blogspot.com/2011/09/default-dimension-storage-in-ax-2012.html 

Tidak ada komentar:

Posting Komentar

Erorr CS1963 - An expression tree may not contain a dynamic operation.

Kali ini saya mendapatkan erorr dengan code CS1963, padahal sebelumnya saya sudah mendefinisikan 'var item in Model' di @foreach(var...