Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to achieve Filtering of the Company Range in AOT Report.

(0) ShareShare
ReportReport
Posted on by

Hi Experts,

I am trying to do a cross company report where i need to filter and show only needed(given) companies in Company range.I have achieved this using following code in AOT Query(used in report) method's.I have  also attached the screen shot for the same.(My system has 100's of companies but i am showing only 4 companies in the result

container getCompanyRange()

{

return [["USMF", true],["BRRT", true],["BRSI", true],["CNMF", true]];

}

Image2send2.png

Now my problem is when i select companies from here using select check box it is not filtering out data correctly in report.Always it return's Data for the 4 companies i selected..Pls help me how to overcome this problem and where i need to customize to solve this issue..

Regards

Varun Gowrishankar

*This post is locked for comments

  • RE: How to achieve Filtering of the Company Range in AOT Report.

    The issue is actually that method(GetCompanyrange) is not dynamically changed according to the values in the Company range tab, for example..if we pass like you told company value's are always false..so nothing is selected each time in fetch method.IF we Pass "TRUE",always true will be selected in fetch method..

  • Suggested answer
    RE: How to achieve Filtering of the Company Range in AOT Report.

    Try this :) I don't find any issue by doing this.

    container getCompanyRange()

    {

          return ["USMF", "BRRT","BRSI", "CNMF"];

    }

    As per my understanding, when u pass all as true, while running query dialog. if u deselect also it will be set as true only because u are passing all the values as True :)

    Check this or elaborate me much better on this, so that i can coordinate with you further to resolve this.

  • RE: How to achieve Filtering of the Company Range in AOT Report.

    Passing True or False is compulsory in that method like i have used below

    container getCompanyRange()

    {

    return [["USMF", true],["BRRT", true],["BRSI", true],["CNMF", true]];

    }

    .If i solve, i surely will let you know

  • Suggested answer
    RE: How to achieve Filtering of the Company Range in AOT Report.

    Then don't pass it as 'True' for all the companies you have mentioned on the method. Let me know if it solves.

  • RE: How to achieve Filtering of the Company Range in AOT Report.

    Hi Arun,

    I have tried this like code below

    qbds    =   qry.dataSourceTable(TableNum(CustInvoiceTrans));

       for(i = 1; i <= conlen(getingCrossCompanyValue);i++)

       {

           onlyCompany =   conpeek(getingCrossCompanyValue,i);//);

           if(conpeek(onlyCompany,2) == true)

       {

           qry.addCompanyRange(strfmt("%1",conpeek(onlyCompany,1)));

       }

       }

       qr      =   new QueryRun(qry);

       while (qr.next())

       {

           CustInvoiceTrans_1 =  qr.get(TableNum(CustInvoiceTrans));

           this.send(CustInvoiceTrans_1);

       }

    But my problem is onlyCompany Container CONTAINS always true as boolean (which is set in getCompanyRange() method ) even when i deselect the company in query Dialog.

  • Suggested answer
    RE: How to achieve Filtering of the Company Range in AOT Report.

    assign all your required legal entity as a container. See the sample code below where i assigned some legal entities in getLegEntity container.

    (you can assign value statically or else get from form or dialog as ur requirement dynamically)

    newquery refers to your query.

    for (counter = 1; counter <= conLen(getLegEntity); counter++)

       {

           curCompanyName = conPeek(getLegEntity,counter);

           changeCompany(curCompanyName)

           {

               newQuery.allowCrossCompany(true);

               newQuery.addCompanyRange(curCompanyName);

           }

       }

  • RE: How to achieve Filtering of the Company Range in AOT Report.

    I have achieved filtering by of the companies by following code in report or queries

    this.query().allowCrossCompany(true);

    this.query().addCompanyRange("111");

    this.query().addCompanyRange("016");

    this.query().addCompanyRange("291");

    this.query().addCompanyRange("303");

    this.query().addCompanyRange("407");

    this.query().addCompanyRange("014");

    My getCompanyRange() method is not affecting my code..

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans