Pages

March 01, 2013

Add multiple range and multiple table lookup

Add multiple range and multiple table lookup





public void lookup()
{
SysTableLookup tableLookup;
QueryBuildRange rangeTransDate;
QueryBuildRange vlgCode,ItemId,DistCode,talCode;
QueryBuildRange CropId;
QueryRun queryRun;
QueryBuildDataSource qbds,qbds1,qbr,qbr1,qbr2;
Query q = new Query();
Query q1 = new Query();
QueryBuildLink QueryBuildLink1,QueryBuildLink2;
_TmpLookup _TmpLookup1;
InventTable InventTable_1;
boolean flg;
;
tableLookup = SysTableLookup::newParameters(tableNum(_TableDetails),this);
qbr = q.addDataSource(tableNum(_TableDetails));
qbr2=qbr.addDataSource(tablenum(_Inspection1));
qbr2.joinMode(Joinmode::NoExistsJoin);
QueryBuildLink2 = qbr2.addLink(fieldnum(_TableDetails, _TableNo),fieldnum(_Inspection1,TableNo));
// qbr2.addRange(fieldnum(_TableDetails,_TableNo)).value(queryNotValue(SysQuery::valueEmptyString()));
qbr2.relations(true);
if(tmpfilter.DistrictCode != "" )
{
qbr.addRange(fieldnum(_TableDetails,_DistrictCd)).value(queryValue(tmpfilter.DistrictCode));
}
if(tmpfilter.talCode != "" )
{
qbr.addRange(fieldnum(_TableDetails,_talCd)).value(queryValue(tmpfilter.talCode));
}
if( tmpfilter.vlgCode != "")
{
qbr.addRange(fieldnum(_TableDetails,_vlgCd)).value(queryValue(tmpfilter.vlgCode));
}
if(tmpfilter.ItemId != "")
{
qbr.addRange(fieldnum(_TableDetails,ItemId)).value(queryValue(tmpfilter.ItemId));
}
// qbr2.addRange(fieldnum(_TableDetails,_TableNo)).value(queryValue(''));
//ss
//ss
// qbr.addRange(fieldnum(_TableDetails,_Area)).value(queryNotValue(0));
//ss
qbr1 = qbr.addDataSource(tablenum(_Table));
qbr1.joinMode(Joinmode::InnerJoin);
QueryBuildLink2 = qbr1.addLink(fieldnum(_TableDetails, RegId),fieldnum(_Table,RegId));
qbr1.relations(true);
if(enum2str(tmpfilter.Season) != "")
{
qbr1.addRange(fieldnum(_Table,_SeasonId)).value(queryValue(tmpfilter.Season));
}
if(tmpfilter.CustAccount != "")
{
qbr1.addRange(fieldnum(_Table,CustAccount)).value(queryValue(tmpfilter.CustAccount));
}
// qbr2.addRange(fieldnum(_TableDetails,_TableNo)).value(queryNotValue(""));
//ss
// qbr2.addRange(fieldnum(_TableDetails,_TableNo)).value(queryValue('090000004'));
//info(_Inspection1.TableNo);
//ss
tableLookup.parmQuery(q);
tableLookup.addLookupfield(fieldNum(_TableDetails,_TableNo));
tableLookup.addLookupfield(fieldNum(_TableDetails, ItemId));
tableLookup.addLookupfield(fieldNum(_TableDetails, ItemName));
tableLookup.setLabel("Name");
tableLookup.performFormLookup();
}
-Harry

No comments:

Post a Comment

Thanks