问题
For example I have the following x++ query.
Select EcoResproduct
join tableX
where EcoResproduct.RecId == tableX.Product
|| EcoResproduct.RecId == tableX.DistinctProductVariant;
Is that possible to do the same thing through AOT query without using a union query or adding two times the same datasource and without using QueryBuildDataSource object and X++ at all .
Thanks in advance
PS: I made my question more clear.
回答1:
Initial incorrect answer:
Is that possible to do the same thing through an AOT query without using a union query or adding two times the same datasource
No.
Correct answer, thanks to the commenters:
Query q = new Query();
QueryBuildDataSource qbds1 = q.addDataSource(tableNum(EcoResproduct));
QueryBuildDataSource qbds2 = qbds1.addDataSource(tableNum(TableX));
qbds2.addrange(fieldNum(TableX, RecId)).value(strFmt('((%2.Product == %1.RecId) || (%2.DistinctProductVariant == %1.RecId))', qbds1.name(), qbds2.name()));
info(qbds1.toString());
来源:https://stackoverflow.com/questions/53006273/aot-query-relation-or-case