Month: July 2017

Merging two queries ranges

HI Below sample code used to merge 2 queries ranges.

private void merge(Query _queryPRA, Query _this)
{
QueryBuildDataSource rpa, pfr;
int rpaRanges,i, rpaFilters;
QueryBuildRange range;
QueryFilter queryFilter;

//Fetch ranges from Query
rpaRanges =_queryPRA.dataSourceTable(tableNum(SalesTable)).rangeCount();
for (i=1 ; i<=rpaRanges; i++)
{
range = _queryPRA.dataSourceTable(tableNum(SalesTable)).range(i);

_this.dataSourceTable(tablenum(SalesTable)).addRange(_queryPRA.dataSourceTable(tableNum(SalesTable)).range(i).field()).value(queryValue(range.value()));
}

//fetch user filters from Dialog
rpaFilters = _queryPRA.queryFilterCount();

for (i=1 ; i<=rpaFilters; i++)
{
queryFilter = _queryPRA.queryFilter(i);

_this.dataSourceTable(tablenum(SalesTable)).addRange(fieldName2id(tableNum(SalesTable), _queryPRA.queryFilter(i).field())).value(queryValue(queryFilter.value()));
}
}