AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 08.01.2010, 16:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
paruvella: Dynamics Ax - Simple SSRS report example by using Ax-Query and Ranges
Источник: http://paruvella.spaces.live.com/Blo...4DB0!408.entry
==============

In this report I am going to use the Ax-Query in the SSRS business logic and report will be generated by using SSRS Business logic.

For this report…

1)      Define the sample Ax Query in Dynamics Ax as follows...

 



 

2)      In the above SampleCustomers query I had defined the ranges for the Name Field.

 

3)      Now go to VS-2008 Create New Project for Dynamics Ax SSRS reports.

 

4)      Open the report from the Solution explorer and Add the new DataMethod to the report as follows 




 5)      Rename the DataMethod and do the code as follows

    [DataMethod(), AxSessionPermission(SecurityAction.Assert)]

    public static DataTable CustomerDetails(String custAccName)

    {

        DataTable custDataTable = new DataTable();

<span style="font-size:10pt;font-family:'Courier New'">        IDictionary<span style="color:blue"string/span, span style="color:blue"object/span> ranges = new Dictionary();

        DataRow customersRow;

        DataTable dtASCAllRows = new DataTable("Customers");

        DataView dvASC = new DataView();

       

       

        //Defining ranges

        object[] rangeName = new object[] { "CustTable.Name" };

        object[] rangeValue = new object[] { custAccName };

 

        ranges.Add(rangeName[0].ToString(), rangeValue[0]);

 

        // execute query - "SampleCustomers" is our Ax Query

        dtASCAllRows = AxQuery.ExecuteQuery((String.Format("Select * from {0}", "SampleCustomers"))

            , ranges);

 

        dvASC.Table = dtASCAllRows;

 

        custDataTable.Columns.Add("AccountNum", typeof(string));

        custDataTable.Columns.Add("AccountName", typeof(string));

        custDataTable.Columns.Add("CustGroup", typeof(string));

 

        // Loop for fetching data for every record

        for (int intLoopCounter = 0;

            intLoopCounter < dvASC.Count; intLoopCounter++)

        {

 

            customersRow = custDataTable.NewRow();

 

            customersRow["AccountNum"] = Convert.ToString(dvASC[intLoopCounter]["AccountNum"]);

            customersRow["AccountName"] = Convert.ToString(dvASC[intLoopCounter]["Name"]);

            customersRow["CustGroup"] = Convert.ToString(dvASC[intLoopCounter]["CustGroup"]);

 

            custDataTable.Rows.Add(customersRow);

        }

 

        return custDataTable;

    }

6)      Define the new Dataset for the report. 

       7)      Assign the properties of the dataset as follows and Map our DataMethod (CustomerDetails) to the Query Property of the DataSet.  

 



8)      Save the solution. Drag and drop the Dataset to the Designs node of the report.

 

9)      Now we can see the report preview of the report by using the Customer name as filter condition.

.....




Источник: http://paruvella.spaces.live.com/Blo...4DB0!408.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Проблема при создании нового Query в Report (AX 2009) Galyna DAX: Программирование 1 21.12.2009 01:56
Dynamics AX Geek: Using query() Blog bot DAX Blogs 0 04.05.2009 14:05
axStart: Please keep the AOT reports in Dynamics AX next release alive Blog bot DAX Blogs 2 13.12.2008 12:18
axStart: Getting Dynamics AX information into Dynamics CRM, the easy way. Blog bot DAX Blogs 0 15.07.2008 02:13
Dynamics AX Geek: Using query() Blog bot DAX Blogs 0 28.10.2006 16:40
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 07:44.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.