13.11.2012, 22:33 | #1 |
Banned
|
AX2012: a way to keep it simple
AX2009:
X++: static void setDimension(Args _args) { CustTable custTable; ttsBegin; while select forUpdate custTable where custTable.LineOfBusinessId { custTable.Dimension[1] = custTable.LineOfBusinessId; custTable.update(); } ttsCommit; } X++: static void setDimension(Args _args) { DimensionValue dimValue; CustTable custTable; DimensionFinancialTag dimFinTag; FinancialTagCategory finTagCat; DimensionAttributeDirCategory dimAttrCat; DimensionAttribute dimAttr; DimensionAttributeValueSetItem dimAttrSetItem; DimensionAttributeValue dimAttrValue; DimensionDefault dimDefaultRecId; ttsBegin; while select forUpdate custTable order by custTable.LineOfBusinessId // the dimension value is stored here where custTable.LineOfBusinessId { if (custTable.LineOfBusinessId != dimValue) { dimValue = custTable.LineOfBusinessId; dimDefaultRecId = 0; select firstOnly dimFinTag where dimFinTag.Value == dimValue join finTagCat where finTagCat.RecId == dimFinTag.FinancialTagCategory join dimAttrCat where dimAttrCat.DirCategory == finTagCat.RecId join dimAttr where dimAttr.RecId == dimAttrCat.DimensionAttribute join dimAttrValue where dimAttrValue.DimensionAttribute == dimAttr.RecId && dimAttrValue.EntityInstance == dimFinTag.RecId; while select count(RecId), maxOf(DimensionAttributeValue) from dimAttrSetItem group by DimensionAttributeValueSet { if (dimAttrSetItem.RecId == 1 && dimAttrSetItem.DimensionAttributeValue == dimAttrValue.RecId) { dimDefaultRecId = dimAttrSetItem.DimensionAttributeValueSet; break; } } } custTable.DefaultDimension = dimDefaultRecId; custTable.update(); } ttsCommit; } Последний раз редактировалось EVGL; 13.11.2012 в 22:43. |
|
|
За это сообщение автора поблагодарили: mazzy (2), S.Kuskov (2). |
Теги |
ax2012, dmf |
|
|