I have a simple RDP report, works fine and as expected. When run in selected legal entity.
I want to enable cross company reporting so that when in selected company I can see data from all other companies if required. I enable property in AOT query and rebuild which adds company range in report query. I am still in same legal entity.
I select same company as legal entity I am in.
All other ranges etc. are correct, data is now incorrect. What else do I have to do to get this working? This is a simple RDP report code pasted below. I have tried enabling crosscompany on queryrun object but is still not working. I just get loads of 0's everywhere.
What else do I need to do to get this working correctly? The ranges code can be ignored this simply captures ranges user selects and prints on report.
[
SRSReportQueryAttribute(queryStr(WIP))
]
public class WIP extends SRSReportDataProviderBase
{
tmpWIP tmpWIP;
TmpRanges tmpRanges;
[
SRSReportDataSetAttribute('tmpWIP')
]
public tmpWIP gettmpWIP()
{
select tmpWIP;
return tmpWIP;
}
[
SRSReportDataSetAttribute(tablestr(TmpRanges))
]
public TmpRanges getTmpRanges()
{
select tmpRanges;
return tmpRanges;
}
public void processReport()
{
ProjTable projTable;
ProjTransPosting projTransPosting;
CostControlTransCommittedCost costControlTransCommittedCost;
EstimateTemplatePeriod EstimateTemplatePeriod;
QueryRun queryRun;
// Get the query from the runtime using a dynamic query.
queryRun = new QueryRun(this.parmQuery());
queryRun.allowCrossCompany(true);
while (queryRun.next())
{
projTable = queryRun.get(tablenum(ProjTable));
ProjTransPosting = queryRun.get(tablenum(ProjTransPosting));
CostControlTransCommittedCost = queryRun.get(tableNum(CostControlTransCommittedCost));
EstimateTemplatePeriod = queryRun.get(tableNum(EstimateTemplatePeriod));
tmpWIP.clear();
tmpWIP.CustAccount = projTable.CustAccount;
tmpWIP.ProjId = projTable.ProjId;
tmpWIP.Name = projTable.Name;
tmpWIP.CustName = projTable.custName();
tmpWIP.AmountMst = projTransPosting.AmountMst;
tmpWIP.CostAmount = projTransPosting.costAmount();
tmpWIP.ProjTransType = projTransPosting.ProjTransType;
tmpWIP.CategoryId = projTransPosting.CategoryId;
tmpWIP.CommittedCostAmount = costControlTransCommittedCost.AmountMst;
tmpWIP.EstimateValue = EstimateTemplatePeriod.Value;
tmpWIP.PostingType = projTransPosting.PostingType;
tmpWIP.insert();
}
this.rangesToTable(this.parmQuery());
}
public void rangesToTable(Query _query)
{
QueryBuildDataSource qbds;
QueryBuildRange queryBuildRange;
LabelType tableLabel;
int occurrence;
int dataSourceNo;
int i;
for (dataSourceNo = 1; dataSourceNo <= _query.dataSourceCount(); dataSourceNo++)
{
qbds = _query.dataSourceNo(dataSourceNo);
if (qbds.enabled())
{
occurrence = SysQuery::tableOccurrence(_query, qbds.table(), dataSourceNo);
tableLabel = tableId2pname(qbds.table()) + SysQuery::tableOccurrenceText(occurrence);
for (i = 1; i <= qbds.rangeCount(); i++)
{
queryBuildRange = qbds.range(i);
if (queryBuildRange.value() && queryBuildRange.status() != RangeStatus::Hidden)
{
tmpRanges.clear();
tmpRanges.FieldLabel = fieldId2pname(qbds.table(), queryBuildRange.field());
tmpRanges.RangeValue = queryBuildRange.value();
tmpRanges.insert();
}
}
}
}
}
}