Archive

Archive for the ‘SSRS’ Category

Custom Lookup for Dimensions in AX 2012 – for User Defined Dimensions

In this article, giving an example for defining the lookup for dimensions in simple way.

This example will cover only for user Defined dimensions.

For this

1)      Created a form and added two string controls.

2)      Named as

Control: Name: Dimensionlist, Auto declaration – Yes

Control: Name: DimValues

3)      Override the lookup method for Dimensionlist

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();

}

4)      Override the lookup method for DimValues

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();

}

}

Run:

Dim list

Dim Values

We can use the same concepts for Dimension controls on Ax 2012 SSRS reports dialog. To build the report dialog UI with dimension controls.

 

Categories: Dynamics Ax 2012, SSRS

Report Server WMI Provider Error

The following article will be useful for two issues..

Error – 1: Report Server WMI Provider Error

Error – 2: Windows Management Instrumentation service is not running.

In my situation, suddenly report server stopped responding, after system and services are re-started.

Failed in trying to connect to Reporting services configuration manager and Reporting Services from SQL Server,

Facing the following error…

Report Server WMI Error

While searching for this issue, did not get exact answer for the above issue.

Tried to repair the report services installation by using SQL Server installation setup file, then found the following reason, in installation check list Windows Management Instrumentation service is not running.

Checked for the same in windows services, service is running, and no issues, successfully re-started also.

Still the same error during installation check list…..

With this error again started searching, got the following link as a solution to my issue.

http://apwot.blogspot.com/2008/09/windows-management-instrumentation.html

 

Categories: Dynamics Ax 2012, SSRS

Save The SRS Printer Settings in Table and Re-Use

In this article,

1)      We can store the printer settings of a report in the table, like in parameters table as a container type field. (Section –I)

2)      While printing the reports, we will read the settings from the parameter table and we will apply the same for report printing.  (Section – II)

static void myPrinterSettingsReport(Args _args)

{

SrsPrintDestinationSettings printSettings;

FormRun                     printSettingForm;

boolean                     ok = true;

Args                        args = new Args();

container                   myPrint;

SrsReportRun                        reportRun;

SRSPrintDestinationSettings srsPrintSettings;

//Section – I

//This we can implement on the parameters form by adding button and define this in click event

printSettings = new SrsPrintDestinationSettings();

args.caller(printSettings);

//calling printersettings form

args.name(formstr(SRSPrintDestinationSettingsForm));

printSettingForm = classfactory.formRunClass(args);

printSettingForm.init();

printSettingForm.run();

printSettingForm.wait(true);

ok = printSettingForm.closedOk();

if (ok)

{

//Retrieving printer settings to a container and this container we can store in to a table

myPrint = printSettings.pack();

}

//Section –II

reportRun = new SRSReportRun();

reportRun.reportName(“Vend.Report”);

// Set printersettings

srsPrintSettings = reportRun.printDestinationSettings();

// while generating the report we can read the printersettings from table (container field value) and pass to the following method.

srsPrintSettings.unpack(myPrint);

reportRun.showDialog(false);

reportRun.init();

reportRun.savePrinterSettings(false);

reportRun.saveReportParameters(false);

reportRun.saveReportQueries(false);

reportRun.run();

}

Categories: Dynamics Ax 2012, SSRS