static void queryForHierarchyNodes(Args _args)
{
EcoResCategory ecoResCategoryMobile, ecoResCategoryInfo, ecoResCategoryLast;
QueryRun qRun;
QueryBuildDataSource qDS;
#EcoResCategoryDefaults
select * from ecoResCategoryMobile where ecoResCategoryMobile.RecId == 5637170077 ;//5637163389;//5637163386; //5637163389;
qRun = new QueryRun(new Query());
qDS = qRun.query().addDataSource(tableNum(ecoResCategory));
qDS.addRange(fieldNum(EcoResCategory, CategoryHierarchy))
.value(queryValue(ecoResCategoryMobile.CategoryHierarchy));
qDS.addRange(fieldNum(EcoResCategory, NestedSetLeft))
.value(Global::queryRange(ecoResCategoryMobile.NestedSetLeft, ecoResCategoryMobile.NestedSetRight));
qDS.addRange(fieldNum(EcoResCategory, NestedSetRight))
.value(Global::queryRange(ecoResCategoryMobile.NestedSetLeft, ecoResCategoryMobile.NestedSetRight));
while (qRun.next())
{
ecoResCategoryInfo = qRun.get(tableNum(EcoResCategory));
//select ecoResCategoryLast where ecoResCategoryLast.ParentCategory == ecoResCategoryInfo.RecId;
//if(!ecoResCategoryLast)
{
//info(ecoResCategoryInfo.getLeafNodes().Name);
info(ecoResCategoryInfo.Name);
}
}
}
{
EcoResCategory ecoResCategoryMobile, ecoResCategoryInfo, ecoResCategoryLast;
QueryRun qRun;
QueryBuildDataSource qDS;
#EcoResCategoryDefaults
select * from ecoResCategoryMobile where ecoResCategoryMobile.RecId == 5637170077 ;//5637163389;//5637163386; //5637163389;
qRun = new QueryRun(new Query());
qDS = qRun.query().addDataSource(tableNum(ecoResCategory));
qDS.addRange(fieldNum(EcoResCategory, CategoryHierarchy))
.value(queryValue(ecoResCategoryMobile.CategoryHierarchy));
qDS.addRange(fieldNum(EcoResCategory, NestedSetLeft))
.value(Global::queryRange(ecoResCategoryMobile.NestedSetLeft, ecoResCategoryMobile.NestedSetRight));
qDS.addRange(fieldNum(EcoResCategory, NestedSetRight))
.value(Global::queryRange(ecoResCategoryMobile.NestedSetLeft, ecoResCategoryMobile.NestedSetRight));
while (qRun.next())
{
ecoResCategoryInfo = qRun.get(tableNum(EcoResCategory));
//select ecoResCategoryLast where ecoResCategoryLast.ParentCategory == ecoResCategoryInfo.RecId;
//if(!ecoResCategoryLast)
{
//info(ecoResCategoryInfo.getLeafNodes().Name);
info(ecoResCategoryInfo.Name);
}
}
}
No comments:
Post a Comment