Financial Dimension - Lookup in AX 2012 R2
Look up to provide all the
custom dimension (Even can be used in SSRS reporting using UI Builder classes)
public void
lookup()
{
Query query;
SysTableLookup sysTableLookup;
super();
sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionAttribute), this);
sysTableLookup.addLookupfield(fieldNum(DimensionAttribute,
Name));
query = new Query();
query.addDataSource(tableNum(DimensionAttribute)).
addRange(fieldNum(DimensionAttribute, Type)).
value(queryValue(DimensionAttributeType::CustomList));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
And the now another lookup
which gives us the value corresponding to the dimension selected in above
lookup. We can implement it either in forms or dialog (can also be used in SSRS
reporting using UI Builder classes).
public void
lookup()
{
DimensionAttribute
dimensionAttribute;
DimensionAttributeDirCategory
dimAttributeDirCategory;
Query
query = new Query();
SysTableLookup
sysTableLookup;
dimensionAttribute =
DimensionAttribute::findByName(Dimensionlist.text());
super();
// Only user defined dimensions will have a financial tag
category
if (dimensionAttribute.Type ==
DimensionAttributeType::CustomList)
{
select firstonly
DirCategory from
dimAttributeDirCategory where
dimAttributeDirCategory.DimensionAttribute == dimensionAttribute.RecId;
sysTableLookup = SysTableLookup::newParameters(tableNum(DimensionFinancialTag), this);
// Add name field to be shown in the lookup form.
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag,
Value));
sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag,
Description));
query = new Query();
query.addDataSource(tableNum(DimensionFinancialTag)).
addRange(fieldNum(DimensionFinancialTag,
FinancialTagCategory)).
value(queryValue(dimAttributeDirCategory.DirCategory));
sysTableLookup.parmQuery(query);
// Perform the lookup.
sysTableLookup.performFormLookup();
}
}
Stay tuned for more J Happy Daxing.
You are my aspiration , I possess few web logs and very sporadically run out from to post : (. Get More Info
ReplyDelete