Thursday, December 15, 2011

Calling a Custom Dynamics AX 2009 SSRS report and passing parameters - From X++

The most recent post, was the following.: Dynamics AX 2009 - Reporting Possibilites

In that post there was a comment left by someone talking about some of the limits that still exist with the custom SSRS reports.

As I point out there are pro's and con's with the custom SSRS reports for Dynamics AX 2009, however one of the things the reader pointed out was passing parameters to the custom SSRS report.

So I thought it would be worth while to do a post on exactly how to do this.

In this example I have created a custom SSRS report for Dynamics AX 2009 instance.



In this you will see I have a Query, that was used for my report, and also a report library I created using Visual Studio 2008 Dynamics AX 2009 Reporting template.

The query, has a Range of SalesId, and in doing that, this was auto added to the report parameters, in the VS2008 projects. (see below image)



This is the name of the parameter in the report def., and therefore important to note for our exercise.

So the task was to take and pass values to reports from X++. I took and create a job that does exactly that. It takes and call my custom reports, output menu item, and pass it a value for the SalesId parameter. The code follows.:


MenuFunction CustRptMI;
Args Args;
;

CustRptMI = new MenuFunction(menuItemOutputStr(srsCustomRpt),MenuItemType::Output)
Args = new Args();
Args.parm("qryCustomSSRS_SalesId=*SO-100004*");
CustRptMI.run(Args);
CustRptMI.wait();


Notice the name of the parameter is exactly the name it is in the VS2008 project for the report def. 'qryCustomSSRS_SalesId'. Then simply and = and then . You can add multiple parameters here with commas, and there you have the report being called, ran, and from X++, parameters being passed and the report generated. (See image below)



So as you can see, you can make use of X++ to call custom SSRS reports, pass in paramaters, and do this pretty simply. You just have to know the exactly parameters names, and you can go from there.

insert_recordset with join query in Ax 2009

The ListOfFields in the destination table must match the list of fields in the source tables. Data is transferred in the order that it appears in the list of fields. Fields in the destination table that are not present in the list of fields are assigned zero-values as in other areas in X++. System fields, including RecId, are assigned transparently by the kernel in the destination table.

insert_recordset  DestinationTable  (  ListOfFields  )
select  ListOfFields1  from  SourceTable  [ where  WhereClause  ]
[ join  ListOfFields2  from  JoinedSourceTable 
[ where  JoinedWhereClause  ]]

~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:

The following X++ code example shows a join of three tables on an insert_recordset statement that has a sub-select. Also, a while select statement with a similar join is shown.

A variable is used to supply the inserted value for one column. The str variable must be declared with a length that is less than or equal to the maximum length of the corresponding database field.

X++ Sample code

static void InsertJoin42Job(Args _args)
{
    GmTabDepartment tabDept2;
    GmTabEmployee tabEmpl3;
    GmTabProject tabProj4;
    GmTabEmployeeProject tabEmplProj5;
    str 64 sDescriptionVariable = "From variable.";
    ;
    DELETE_FROM tabEmplProj5;

    INSERT_RECORDSET tabEmplProj5 (Description, EmployeeRecId, ProjectRecId)    Select  sDescriptionVariable, RecId   from    tabEmpl3
      join   tabDept2    where tabEmpl3 .DepartmentGuid == tabDept2 .DepartmentGuid
        join RecId   from tabProj4 where tabDept2 .DepartmentGuid == tabProj4 .DepartmentGuid
    ;
    info(int642str(tabEmplProj5 .rowCount())
        + " ==Number of rows inserted.");
    WHILE SELECT *
        from
            tabEmplProj5
            join tabEmpl3
                where tabEmplProj5 .EmployeeRecId == tabEmpl3 .RecId
            join tabProj4
                where tabEmplProj5 .ProjectRecId == tabProj4 .RecId
    {
        info(
            tabEmpl3 .EmployeeName
            + "  --works on--  "
            + tabProj4 .ProjectName
            + " (" + tabEmplProj5 .Description + ")."
            );
    }
/*****************  Actual Infolog output
Message (01:05:41 pm)
4 ==Number of rows inserted.
Alice  --works on--  Project ZZZ (From variable.).
Alice  --works on--  Project YY (From variable.).
Beth  --works on--  Project ZZZ (From variable.).
Beth  --works on--  Project YY (From variable.).
*****************/
}

Wednesday, December 14, 2011

Creating SSRS Reports with Visual Studio 2008 for DAX 2009

To develope SSRS Reports in Visual Studio 2008 following requisite should be install on your machine.

1. Reporting Extensions ( From Ax Setup)
2. Visual Studio 2008
3. Reporting Tools ( From Ax Setup)
~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~

Creating SSRS Reports for Microsoft Dyanamics Ax 2009 with Visual Studio 2008.

1. Open VS 2008
2. New --> Project --> Visual C# -->Dynamics-->Dynamics Ax Reporting Project
3. Develop Reports
4. Right click and Save to AOD
5.Or deploy
6. fom ax application goto Reports Libraries-->Select report project and deploy.

To show report on the content pane in the reports column

1. create new output menu for displaying reports
2. In properties select ObjectType as  SQLReportLibraryReport
3. select developed report
4. Place the output menu on your reports pane to be display.

Friday, December 9, 2011

AX 2009 - Installing Reporting Extensions on Windows server 2008 steps

hi friends,

The below are the steps which i followed while installing reporting extensions on Windows server 2008.

1. Install SQL Server 2008 with Reporting Services.
2. Install Ax - 2009 Application files,AOS, Client,
3. Install All the prerequisite for Reporting Extensions
    To install these software components, see Install prerequisites on the report server.
4. Install Reporting Extensions and .Net business connector.
3. Configure Report server with the Microsoft SQL SERVER 2008 >> Configuration and Tools >> Reporting Services configuration Manager
4. Deploy Reports using the path Microsoft Dynamics Ax 2009 >> Microsoft Dynamics Ax 2009 Reports Deployment.

Tuesday, December 6, 2011

box::yesno syntax in Dynamics ax 2009

A simple way to let the user deside what is going to happen.
1
2
3
4
5
6
7
if(box::yesNo("Do you want something to happen?", 
      dialogbutton::Yes) == dialogbutton::Yes)
   {         
 
          somethingHappens = this.callTosSomeReturnMethod();
 
   }

Wednesday, November 16, 2011

Enterprise Portal Deployment



                             Enterprise Portal Deployment
Microsoft Dynamics AX 2009

~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:

Blogs to help about EP Portal Deployment.


~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:~:

EP deployment Steps