Hello all,
I'm trying to apply query range on a report but it's not working.
I have tried following
queryBuildDataSource = query.dataSourceTable(tablenum(InventTrans));
queryBuildRange = SysQuery::findOrCreateRange(query.datasourceTable(tableNum(InventTrans)),fieldNum(InventTrans,DateFinancial));
queryBuildRange.value(SysQuery::range(Fromdate,ToDate));
qbds = query.addDataSource(tableNum(InventLocation));
qbds1 = query.addDataSource(tableNum(InventItemGroupItem));
qbds2 = query.addDataSource(tableNum(CustTable));
qbds3 = query.addDataSource(tableNum(EcoResCategory));
if(WHName)
{
query.dataSourceTable(tableNum(InventLocation)).addrange(fieldNum(InventLocation,Name)).value(WHName);
}
if(Brand)
{
query.dataSourceTable(tableNum(InventItemGroupItem)).addrange(fieldNum(InventItemGroupItem,ItemGroupId)).value(Brand);
}
if(CustGroup)
{
query.dataSourceTable(tableNum(CustTable)).addrange(fieldNum(CustTable,CustGroup)).value(CustGroup);
}
if(EcoResCategoryS)
{
select ItemID, Product from lclInventTable1
join ecoResProductCategory1 where ecoResProductCategory1.Product == lclInventTable1.Product
join ecorescategory1 where ecorescategory1.recid == ecoresproductcategory1.Category
join ecorescategoryhierarchy1 where ecorescategoryhierarchy1.RecId == ecoresproductcategory1.CategoryHierarchy
&& ecorescategoryhierarchy1.Name == 'Sales Category'
&& ecorescategory1.Name == EcoResCategoryS;
query.dataSourceTable(tableNum(EcoResCategory)).addrange(fieldNum(EcoResCategory,Name)).value(ecorescategory1.Name);
}
if(EcoResCategoryP)
{
select ItemID, Product from lclInventTable1
join ecoResProductCategory1 where ecoResProductCategory1.Product == lclInventTable1.Product
join ecorescategory1 where ecorescategory1.recid == ecoresproductcategory1.Category
join ecorescategoryhierarchy1 where ecorescategoryhierarchy1.RecId == ecoresproductcategory1.CategoryHierarchy
&& ecorescategoryhierarchy1.Name == 'Product Category'
&& ecorescategory1.Name == EcoResCategoryP;
query.dataSourceTable(tableNum(EcoResCategory)).addrange(fieldNum(EcoResCategory,Name)).value(ecorescategory1.Name);
}
Thanks