Friday, July 5, 2013

Getting Main account from the ledger dimension record id

private DimensionValue gettingMainAccount(LedgerDimensionDefaultAccount _ledgerJournalId)
{
DimensionAttributeValueCombination DimensionAttributeValueCombination;
DimensionAttributeValueGroupCombination DimensionAttributeValueGroupCombination;
DimensionAttributeValueGroup DimensionAttributeValueGroup;
DimensionHierarchyLevel DimensionHierarchyLevel;
DimensionAttribute DimensionAttribute;
DimensionAttributeLevelValueAllView DimensionAttributeLevelValueAllView;
DimensionValue MainAccount = '';

select DimensionAttributeValueCombination where DimensionAttributeValueCombination.RecId==_ledgerJournalId;

while select DimensionAttributeValueGroupCombination
where DimensionAttributeValueGroupCombination.DimensionAttributeValueCombination==DimensionAttributeValueCombination.RecId
{
//print DimensionAttributeValueGroupCombination.DimensionAttributeValueGroup;
//pause;
//5637158202, 5637158203

while select DimensionAttributeValueGroup
where DimensionAttributeValueGroup.RecId==DimensionAttributeValueGroupCombination.DimensionAttributeValueGroup
{
//print DimensionAttributeValueGroup.DimensionHierarchy;
//pause;
//5637145368

while select DimensionHierarchyLevel
where DimensionHierarchyLevel.DimensionHierarchy==DimensionAttributeValueGroup.DimensionHierarchy
&& DimensionHierarchyLevel.Level==1
{
//print DimensionHierarchyLevel.DimensionAttribute;
//pause;
//5637144840, 5637144850, 5637144851, 5637144849

while select DimensionAttribute
where DimensionAttribute.RecId==DimensionHierarchyLevel.DimensionAttribute
&& DimensionAttribute.Type==DimensionAttributeType::MainAccount
{
//print DimensionAttribute.BackingEntityType;

//print DimensionAttribute.Name;

//pause;

select DimensionAttributeLevelValueAllView
where DimensionAttributeLevelValueAllView.DimensionAttribute==DimensionAttribute.RecId
&& DimensionAttributeLevelValueAllView.DimensionAttributeValueGroup==DimensionAttributeValueGroupCombination.DimensionAttributeValueGroup
//&& DimensionAttributeLevelValueAllView.AttributeValueHashKey==dimAttrWorker.Key

;
MainAccount = DimensionAttributeLevelValueAllView.DisplayValue;
}
}
}
}
return MainAccount;
}

No comments:

Post a Comment