Insert of list of Financial Dimensions values under a specific dimension name(in master) through x++ code

The Crucial steps to be remembered while performing this operations are as follows. Untitled

Here is the code………

static void listofFinDimValues(Args _args)
{

DimensionAttribute dimensionAttribute;
RecId financialcategoryRecid;
LogisticsAddressCountryRegion logisticsAddressCountryRegion;
DimensionFinancialTag dimensionFinancialTag;
FinancialTagCategory financialTagCategory;
dimensionAttribute = DimensionAttribute::findByName(‘Country’);  // 1. Find DimAttribute record financialcategoryRecid = dimensionAttribute.financialTagCategory(); // 2.Call financialTagCategory() 

while select * from logisticsAddressCountryRegion
{
select dimensionFinancialTag where
dimensionFinancialTag.FinancialTagCategory == financialcategoryRecid && 
DimensionFinancialTag.Value == LogisticsAddressCountryRegion.CountryRegionId;

// This select statement prevents to add existing records.
if(!dimensionFinancialTag.RecId)
{
// 3. Create new DimensionFinancialTag record with the category and your Value and Description. dimensionFinancialTag.Value = logisticsAddressCountryRegion.CountryRegionId; dimensionFinancialTag.Description = LogisticsAddressCountryRegionTranslation::find(logisticsAddressCountryRegion.CountryRegionId).ShortName;
dimensionFinancialTag.FinancialTagCategory = financialcategoryRecid; dimensionFinancialTag.insert();

}
}
}
Happy DaXing………

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: