AllowCrossCompany property of an AOT query and still addCompanyRange() is not working


I am making some changes to the Customer aging report (AR/Reports/Status) . The request is to be able to see the cross company results. I did the below steps and it doesn’t seem like adding the companies to the CustAgingReport query.

  1. Changed the AllowCrossCompany property of the CustAgingReport to “Yes”

2). With the above change I do see the ‘Conpany Range’ tab in the Select query wizard screen when clicked on the Select button is clicked on. I am able to select the companies that I would like to search in


3). Created a new method in the CustAgingReportDP class to add the selected companies to the query. Below is the code

private void masAddCompanyRange(Query _query)
    container                companies = this.parmQuery().getCompanyRange();
    int                      i;
    DataAreaId               companyLocal;
     QueryBuildDataSource    qbdsLocal;
    qbdsLocal = _query.dataSourceTable(tableNum(CustTable));
    for (i=1;i<=conLen(companies);i++)
        if(conPeek(conPeek(companies, i), 2))
            info(strFmt('1%',conPeek(conPeek(companies,i), 1)));
            companyLocal = conPeek(conPeek(companies,i), 1);

but while debugging when I look at the query text I don’t see the range has been added to it. The query looks like this

SELECT * FROM CustTable(CustTable) WHERE ((AccountNum = N’468057’ OR AccountNum = N’407178’)) AND ((CustGroup = N’20’))

4). I have tried using the line of code

_query.dataSourceName(‘CustTable’).addRange(fieldnum(CustTable,DataAreaId)).value(queryvalue(companyLocal)); and it does the range but at the end it is throwing the below error

“Filtering at the data source level is not allowed for a cross-company query.”

Am I missing something?



Isn’t the only problem in what you get from toString()? You normally don’t see partition and data area filters there, despite the fact that they’re applied to the actual SQL queries to database.