I have the below X++ query and I need to convert it to query to be used in Lookup method for ProjID field , does the code in the method lookup below precisely correspond to the X++ query ?
while select ProjId from projTable join projGroup join ProjStatusTypeRule
where projTable.Header==false
&& projTable.ProjGroupId== projGroup.ProjGroupId
&& projGroup.AllowCreateCourse==true
&& projTable.Type== ProjStatusTypeRule.ProjType
&& projTable.Status== ProjStatusTypeRule.ProjStatus
&& projStatusTypeRule.ProjStatusRule==ProjStatusRule::CreateCourse
{
info(strFmt("%1",projTable.ProjId));
}
public void lookup()
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(ProjTable), This);
Query query = new Query();
QueryBuildDataSource queryBuildDataSource,Qbds1, Qbds2;
QueryBuildRange queryBuildRange;
super();
queryBuildDataSource = query.addDataSource(tableNum(ProjTable));
queryBuildDataSource.addRange(fieldNum( ProjTable, Header)).value("=0");
Qbds1 = queryBuildDataSource.addDataSource(tableNum(ProjGroup));//
Qbds1.joinMode(JoinMode::InnerJoin);//
Qbds1.addLink(fieldNum(ProjTable, ProjGroupId), fieldNum(ProjGroup, ProjGroupId));//
Qbds1.addRange( fieldNum( ProjGroup, AllowCreateCourse)).value("=1");
Qbds2 = queryBuildDataSource.addDataSource(tableNum(projStatusTypeRule));//
Qbds2.joinMode(JoinMode::InnerJoin);//
Qbds2.addLink(fieldNum(ProjTable, Type), fieldNum(projStatusTypeRule, ProjType));//
Qbds2.addLink(fieldNum(ProjTable, Status), fieldNum(projStatusTypeRule, ProjStatus));//
Qbds2.addRange( fieldNum( projStatusTypeRule, ProjStatusRule)).value(queryValue(ProjStatusRule::CreateCourse));
sysTableLookup.parmQuery(query);
sysTableLookup.addLookupfield(fieldNum(ProjTable,ProjId));
sysTableLookup.addLookupfield(fieldNum(ProjTable,Name));
//sysTableLookup.addLookupfield(fieldNum(ProjTable,Status));
//sysTableLookup.addLookupfield(fieldNum(ProjTable,Header));
//sysTableLookup.addLookupfield(fieldNum(ProjGroup,ProjGroupId));
sysTableLookup.performFormLookup();
}
*This post is locked for comments