web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Selecting a range to print Sales Account and the Details

(0) ShareShare
ReportReport
Posted on by

I' ve created a set of report classes. Currently I m only able to print on a selected sales account and it details. what I wanted is to print a selected range of sales account. from example the sales accountfrom is 520 and sales accountto is 900. Then the report will print the selected salesaccount into the report.  Where can I add the range for my code? 

// Data provider

[ //SRSReporueryAttribute(queryStr()),
SRSReportParameterAttribute(classStr(TestingSalesContract))
]


class TestingSalesDataProvider extends SRSReportDataProviderBase

{
    Testing_SalesLine      salesLine;
    Testing_SalesHeader1    salesHeader;
    Testing_SalesLineTmp    salesLineTmp;
    TestingSalesContract    contract;
    RecordInsertList        recordInsertListTmpTable;


}

[SRSReportDataSetAttribute(tablestr('Testing_salesLineTmp'))]
public Testing_salesLineTmp getSalesLine()
{
    ;
    return salesLineTmp;
}

[SysEntryPointAttribute]
public void processReport()
{
     Testing_SalesAccount       salesAccountFrom;
    Testing_SalesAccount        salesAccountTo;
    ;
    contract = this.parmDataContract() as TestingSalesContract;
    salesAccountFrom = contract.parmSalesAccountFrom();
    salesAccountTo  = contract.parmSalesAccountTo();
    
    



    while select * from salesLine //select all dat  from sales line
    
       
    where salesLine.SalesAccount == salesAccountFrom // if  input sales acccount was equal then showdata
    
    {// print to tmp table
        salesLineTmp.clear();
        salesLineTmp.SalesAccount = salesLine.SalesAccount;
        salesLineTmp.CustomerID = salesLine.CustomerID;
        salesLineTmp.CustomerName = salesLine.CustomerName;
        salesLineTmp.ItemID =  salesLine.ItemID;
        salesLineTmp.ItemName = salesLine.ItemName;
        salesLineTmp.ItemPrice = salesLine.ItemPrice;
        salesLineTmp.ItemQuantity = salesLine.ItemQuantity;
        salesLineTmp.ItemTotal = salesLine.ItemTotal;
        salesLineTmp.insert();
    }
}




//UI builder

class TestingSalesUIBUilder extends SysOperationAutomaticUIBuilder
{
    TestingSalesContract contract;

    DialogField     dialogSalesAccountFrom;
    DialogField     dialogSalesAccountTo;

}

public void build()
{
    contract = this.dataContractObject();

    dialogSalesAccountFrom = this.addDialogField(methodStr(TestingSalesContract,parmSalesAccountFrom),contract);
    dialogSalesAccountTo = this.addDialogField(methodStr(TestingSalesContract,parmSalesAccountTo),contract);



}

//contract 

[DataContractAttribute,
SysOperationContractProcessingAttribute(classstr(TestingSalesUIBUilder))
]
class TestingSalesContract
{
    Testing_SalesAccount     salesAccountFrom;
    Testing_SalesAccount    salesAccountTo;


}

[DataMemberAttribute('salesAccountFrom') ]
public Testing_SalesAccount parmSalesAccountFrom(str _salesAccountFrom = salesAccountFrom)
{
    salesAccountFrom = _salesAccountFrom;
    return salesAccountFrom;

}

[DataMemberAttribute('salesAccountTo') ]
public Testing_SalesAccount parmSalesAccountTo(str _salesAccountTo = salesAccountTo)
{
    salesAccountTo = _salesAccountTo;
    return salesAccountTo;

}

// controller

class TestingSalesController extends SrsReportRunController
{


}

public static void main(Args _args)
{
    TestingSalesController controller;

    ;

    controller = new TestingSalesController();


    controller.parmArgs(_args);
    controller.parmReportName(ssrsReportStr(TestingSales, PrecisionDesign1  ));
    controller.parmDialogCaption('SalesLine');

    controller.startOperation();

}


*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: Selecting a range to print Sales Account and the Details

    never mind I found the problem it was the dataset from visual studio. Thank for helping me Istvan.

  • Community Member Profile Picture
    on at
    RE: Selecting a range to print Sales Account and the Details

    Yeah I got what I wan with this query. but I could get the salesAccountTo.

    I tried change the "<=" only sales accountfrom work. salesAcoountTo print nthing

  • Suggested answer
    István Orosz Profile Picture
    2,137 on at
    RE: Selecting a range to print Sales Account and the Details

    This line should be modified:

     where salesLine.SalesAccount == salesAccountFrom // if  input sales acccount was equal then showdata

    in public void processReport()

  • Community Member Profile Picture
    on at
    RE: Selecting a range to print Sales Account and the Details

    Where do i add the query? Do you have any example of it?

  • Verified answer
    István Orosz Profile Picture
    2,137 on at
    RE: Selecting a range to print Sales Account and the Details

    Hi,

    You should modify the processReport() main query to something like this:

    salesLine.SalesAccount >= salesAccountFrom && salesLine.SalesAccount <= salesAccountTo

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans