Use variable in multiple classes

Thanks in advance!

Very new to AX, so be specific in response if you can help and don’t worry about offending me, because I already feel stupid when it comes to this so far.

I’m manually setting the report design at runtime based on a parameter using the following in ReportController\PreRunModifyContract.

protected

void preRunModifyContract()

{

myReportContract contract = this.parmReportContract().parmRdpContract()

as MyReportContract;

this.parmReportContract().parmReportName(this.getReportName(contract));

super();

}

The ReportName variable is populated in ReportController\GetReportName method and returned to this method.

Okay, my question is how can I access this variable (ReportName) in another Class?

I want to use it in the ReportDataProvider class\insertToTempTable method so if the design is ‘report design 1’ then run a specific method to populate a group of temp table variables…else if it is ‘report design 2’, run a different method that will populate the same fields with different values.

Or…is there a way I can retrieve the report design name from the report properties (since it should already be set at this point)?

The simplified version of my code will look something like this:

// I need to get ReportName value before the following code executes…either from other class or from report properties?

If(ReportName == ‘Report Design 1’

{

myVariable = myTable.method1().value;

}

Else

{

myVariable = myTable.method2().value;

}

Thanks for looking. Hope someone can help.

Use the following code.

if( element.design().name() == ‘Report 1’)

{

// your code

}

else

{

// your code

}

Thanks.

I just tried it, but I get ‘Variable element has not been declared’.