Sometimes there is a requirement to create a new field on a table that should be populated from a custom financial dimension values. And you want to show a lookup on the data entry form for this field that populates the data from your custom financial dimension.
To meet this requirement the following tables are important.
– DimensionFinancialTag
– DimensionAttribute
– DimensionAttributeDirCategory
– FinancialTagCategory
The list of values for your custom dimension are stored in the table DimensionFinancialTag. But this table stores custom values for all custom financial dimensions. To determine which of the records to filter out and show we will have to apply a filter on the field FinancialTagCategory. How do we figure out what is the financialtagcategory value? We do that by traversing from the DimensionAttribute table which holds a record for your financial dimension. The table DimensionAttributeDirCategory holds a link between DimensionAttribute and FinancialTagCategory. You use this table to retrieve the financialtagcategory and filter the records in the table DimensionFinancialTag.
Here is some sample code…
SysTableLookup sysTableLookup; Query query; QueryBuildDataSource qbdsDimensionFinancialTag; QueryBuildRange qbrFinancialTagCategory; ; #define.MyCustomFinancialDimension('MyCustomFinancialDimension') query = new Query(); qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag)); qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory)); qbrFinancialTagCategory.value(strFmt('%1', DimensionAttribute::findByName(MyCustomFinancialDimension, false).financialTagCategory())); sysTableLookup = sysTableLookup::newParameters(tableNum(DimensionFinancialTag), this); sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true); sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description)); sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup();
A brief description of the tables…
DimensionAttribute: This table stores the dimension attribute name and a link to the DimensionAttributeDirCategory (basically category)
DimensionAttributeDirCategory: This table links dimension attribute with FinancialTagCategory table.
FinancialTagCategory: This table is the core table for category. Apparently it is used for grouping of custom financial dimensions. Probably a way for us to share custom financial dimension values across multiple custom financial dimensions.
DimensionFinancialTag: This tables stores the custom financial dimension values. And also a link to FinancialTagCategory identifying the category for each value.