Filter SSRS report by selected record

Hi Guys,

I Need help here. This is the first time i do this task and i don’t how to do it.

I know how to create SSRS report using RDP.

Just a basic report, input the parameter to get the desire output.

now i want to get the selected S.O. without any input in the parameter…

when i choose S.O. then i will click the Button, as shown image above.

I’m using MenuItemButton and Output

Please help …

Thank you in advance

Hi,
It’s a little bit different architecture, you must implement controller class to take your current record as parameter.
You can take a look in VendInvoiceDocumentController for exemple.It will be helpful.

In general, your report controller should get the active record from the caller and either add a query range, or fill a value in data contract (depending on how your report works). This can be done in controller’s preRunModifyContract().

It’s not a detailed answer, nevertheless I’m not sure which part you’re struggling with. Let’s talk about details after we reduce the scope.

Sorry mehdi,

Its confusing… i’am not a ax developer…

Then you have two options:

  • either stop meddling with AX development and leave it to an actual developer
  • or become an AX developer (by learning how to do it)

I’m here to learn.

to become a ax developer…

Why you questioning me like…?

hays…

this is my XPO.

6406.dasd.jpg

MenuItemButton and Output

Actually martin, this report is from Morphx Report and i convert it to SSRS report.

You didn’t say that. You said that you’re not a developer, therefore I assumed that you’re somebody in a different role who thought that it can’t be too difficult to make a few changes. Don’t forget that we don’t know anything about you or your problem unless you write it down here, therefore it’s extremely important to share as much information as possible. Don’t assume that we can read your mind.

From now, don’t use the excuse that you’re not a developer. You’re a developer who has a plenty to learn.

Back to your question. We gave you some hints, but all we got from you is “its confusing”. That’s not very detailed. Please try it again and tell us what’s so confusing for you.

I also suggest you don’t try to implement the whole thing at once. Split it to several parts and implement them one by one. For example, you can first learn how to get the active record, without bothering how to filter the report.

Dealing with complexity is the most important task for every developer and if you’re a newbie, it’s even more important for you. Work in small steps, otherwise the complexity paralyzes you.

If you have an existing report, it’s possible that you can get some logic from it, such as getting the active record.

Again, you’ll have to explain your particular problem. Just showing a picture of a report in AOT doesn’t explain what you want to learn from us.

Ok i will try to be more explicit .You have to add a controller class wich contain a method like this one:

this sample of code is for printing a selected purchase oder.

protected void prePromptModifyContract()
{
VendPurchOrderJour dataTable;
POReportContract contract;
if(this.parmArgs() && this.parmArgs().record())
{
contract = this.parmReportContract().parmRdpContract() as POReportContract;
dataTable = this.parmArgs().record();// retrieving the table selected
contract.parmPurchId(dataTable.PurchId);//retrieving the current record id as parameter

}

}

and after that you have to put the name of controller class instead of DPClass in visual studio properties.

I hope it will help you.

Okay Martin…

Sorry for that…

Actually my problem is on how to get the active records?

I want to learn the step by step procedure on how to get the active records…

I generate my report like this…

just typing the S.O. number

which wrong.

Thanks mehdi,
Sorry for what i said last reply.

Thanks for this, now i have a little idea…

but i confuse here?

“and after that you have to put the name of controller class instead of DPClass in visual studio properties.”

may be its better to put in MenuItem-output…

First of all, make sure that you have the documentation on hand: Development Tasks for Reporting [AX 2012]. You might also want to look at some tutorials written by other people (such as this). This will give you some idea about how report development works, how to create basic classes and so on.

Create a controller class (a new class extending SrsReportRunController) and implement the main() method. Like this:

public static client void main(Args _args)
{
    YourController controller = new YourController();     
    controller.parmReportName(ssrsReportStr(YourReport,Design));     
    controller.startOperation(); 
}

Make sure you understand what it does before continuing.

Then create a menu item pointing to this class and use it in your form. Set DataSource property of the menu item button the the datasource you want to get in the class.

Then you can call _args.record() in main() method to get the record. It’s not the right place where you should do it, but it will prove that you can get the record to the class.

You have to create your visual Studio Project for SSRS reports like when using RDPClasses. In properties you have assigned the name of RDPClasse. In this case you have to assign the name of your controller class. Is it clear now?

Thank you Martin and Souihli,

i create a controller and it’s now working fine …