AOT Query relation OR case

≡放荡痞女 提交于 2019-12-25 03:16:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!