InventValueReportView query build data source sales line range filter

Hi all …

i want to pass the cust group ASAP-3000 in rage to skip the values of qty for item on date which is coming under this group customers … so i tried this logic … but i m getting this error …

1:N Fetch Mode is not allowed on Datasource having join condition with node other than its immediate parent.

private void buildAsOfQuery()
{
QueryBuildDataSource qbdsInventView;
QueryBuildDataSource qbdsSalesLine;

this.buildCommonQuery();
qbdsInventView = qbds.addDataSource(tableNum(InventValueReportView));

//--------- newly added for customization to avoid the cust group
query.allowCrossCompany(true);

qbdsSalesLine = qbds.addDataSource(tableNum(SalesLine));
qbdsSalesLine.addLink(fieldNum(InventValueReportView, InventTransId),fieldNum(SalesLine, InventTransId));
qbdsSalesLine.addRange(fieldNum(SalesLine, CustGroup)).value(SysQuery::valueNot(“ASAP-3000”));
//-------------

qbdsInventView.addLink(fieldNum(InventTable, ItemId), fieldNum(InventValueReportView, ItemId), qbdsInventTable.name());
qbdsInventView.addRange(fieldNum(InventValueReportView, TransDate)).value(queryRange(contract.parmAsOnDate() + 1, dateMax()));
qbdsInventView.orderMode(OrderMode::GroupBy);
qbdsInventView.addSelectionField(fieldNum(InventValueReportView, Qty), SelectionField::Sum);
if (buildAsOfQtyAndAmountQuery)
{
qbdsInventView.addSelectionField(fieldNum(InventValueReportView, Amount), SelectionField::Sum);
}

if (!inventDimParm.isAllFlagNo() || this.contractHasRange(tableNum(InventDim)))
{
qbds = this.addInventDim(qbdsInventView, fieldNum(InventValueReportView, InventDimId));
}
}

We don’t have much details about your query. What is your query structure?
Which part of the line is triggering that error? Where you are doing these modifications?
Please provide more details.

Let me also copy my reply from the duplicate thread on another forum, so others don’t have to waste time with the same thing again:

I think you intended to add SalesLine datasource to qbdsInventView instead of qbds.

class – InventAgingQueryBuilder - method --buildAsOfQuery()

we have 10 legal entites . so i want to avoid the internal group sales and purchase of the items … cust group - ASAP-3000 , vend group -“GROUP”

In Inventview how i check cust group nd vend group for against Item id and reference

I’m sorry, but I don’t understand what you mean and how it’s related to the error discussed in this thread (“1:N Fetch Mode is not allowed on Datasource having join condition with node other than its immediate parent”). Please explain it.