Wednesday, May 27, 2015

How to create Info part and use it on List page

This post is about how to create info Part in AX and use it on list page.

For this example; I am using Projects List page and will add Revenue Info Part on it.

Right click on AOT\Parts\Info Parts and create New Info Part

Assign Query to this info part I have assigned ProjTable_NoFilter query

Add New Group under Layout

Name it ProjectRevenue and set few properties as shown

Note I haven't assigned DataSource to this group, I will be using data methods to get data here.

Add new fields under ProjectRevenue group and name it RevenueAtSales and RevenueAtOrders

I assigned ForecastRevenueAtSalesSw data method to field RevenueAtSales, this data method is written on at \Data Dictionary\Tables\ProjTable\Methods\forecastRevenueAtSalesSw

display AmountCur forecastRevenueSw()
    ProjForecastOnAcc projForecastOnAcc;
    real total;

    // Sum all the prices with quantity of 1.
    select sum(SalesPrice) from projForecastOnAcc
        where projForecastOnAcc.ProjId == this.ProjId
           && projForecastOnAcc.Qty == 1;

    total = projForecastOnAcc.salesPrice;

    // Support non-unity quantities.
    while select SalesPrice, qty from projForecastOnAcc
        where projForecastOnAcc.ProjId == this.ProjId
           && projForecastOnAcc.Qty != 1
        total += (projForecastOnAcc.salesPrice * projForecastOnAcc.qty);

    return total;

Add this Info part to ProjProjectsListPage as I want to see this on Project List page.

Right click on Parts node in ProjProjectsListPage

Name it FF_ProjectRevenue

Set IsLinked Property to YES, this property will link this part to the list page based on Datasource (ProjTable)

Create new display menu item and name it FF_ProjectRevenueMenuitem

Assign this menu item as Part property in ProjProjectListPage

Time to see this info Part on List page, Open All Projects form and here it goes

Happy Daxture!ng