Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 10657

Reduce SSRS deployment time for static reports in AX2012

$
0
0
Are you wasting minutes deploying and redeploying static SSRS reports in all the languages provided with AX2012? If you only need a handful of them, you might just as well consider disabling the licenses for the unwanted languages. You can enable them back if you need them later.

Now disabling one language at a time manually might not be your cup of tea, so I would like to share a small job that disables all languages except the ones you want to keep enabled. Just create a new job and paste in the code below. Use at own risk of course, take backups and backups of the backups etc (you know the drill).


// Remove licence codes for unwanted languages
static void AdLanguageRemover(Args _args)
{
SysConfig sysConfig;
SysRemoveLicense remLic;

Query query;
QueryBuildDataSource qbd;
QueryBuildRange qbr;
QueryRun queryRun;

FormRun confirmForm;
Set languagesToKeep = new Set(Types::String);
Set licenseCodeSet = new Set(Types::Integer);
SetEnumerator it;
int confCount = 0;
boolean licenseChanged = false;
Args args = new Args(formStr(SysLicenseCompareForm));
boolean proceed = false;
SysLicenseCodeDescription codeDescription;
str currentLanguageId;
int pos, sysConfigId;

// List of languages to keep. Add, remove, change to fit your preference
languagesToKeep.add('nb-no');
languagesToKeep.add('en-us');
languagesToKeep.add('sv');
languagesToKeep.add('nl');
languagesToKeep.add('fr');
languagesToKeep.add('da');
languagesToKeep.add('de');

query = new Query();
qbd = query.addDataSource(tableNum(sysConfig));

qbr = qbd.addRange(fieldNum(SysConfig,ConfigType));
qbr.value(enum2Value(ConfigType::AccessCodes));

qbr = qbd.addRange(fieldNum(SysConfig,Id));
qbr.value(SysLicenseCodeReadFile::rangeLanguage());

queryRun = new QueryRun(query);

delete_from remLic;

while (queryRun.next())
{
if (queryRun.changed(tableNum(sysConfig)))
{
sysConfig = queryRun.get(tableNum(sysConfig));
}

codeDescription = SysLicenseCodeReadFile::codeDescription(sysConfig.Id);
pos = strFind(codeDescription,'(',strLen(codeDescription),-strLen(codeDescription));
currentLanguageId = subStr(codeDescription,pos+1,strLen(codeDescription)-pos-1);

if (!languagesToKeep.in(currentLanguageId))
{
warning(strFmt('Removing language %1',SysLicenseCodeReadFile::codeDescription(sysConfig.Id)));
licenseCodeSet.add(sysConfig.Id);
remLic.clear();
remLic.LicenseCode = sysConfig.Id;
remLic.Description = SysLicenseCodeReadFile::codeDescription(sysConfig.Id);
remLic.insert();
}
else
{
info(strFmt('Keeping language %1',SysLicenseCodeReadFile::codeDescription(sysConfig.Id)));
}

}

if (licenseCodeSet.elements())
{
// if not valid code, then we should display the warning
confCount = SysLicenseCodeReadFile::findConfigKeysFromLicenseCodeSet(licenseCodeSet);

confirmForm = classfactory.formRunClass(args);
confirmForm.init();
confirmForm.run();
confirmForm.wait();

if (confirmForm.closedOk())
{
it = licenseCodeSet.getEnumerator();
while (it.moveNext())
{
sysConfigId = it.current();

update_recordSet sysConfig
setting value = ''
where sysConfig.id == sysConfigId;

}

SysLicenseCodeReadFile::codesModified();
}
}
}

Allow for a synchronization to run through after the licenses are modified. Remember that this may impact the database schema, but if you really do not want the (ie.) Norwegian language to be enabled, it should be safe to disable. Thanks for reading!

Viewing all articles
Browse latest Browse all 10657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>