Project list page - to filter and show data as per last selection
public Query applyFilter(Query _query, boolean _saveFilterValues = false)
{
//QueryBuildDataSource parentProjTableDataSource, parentProjTableDataSource2;
int s;
//CtrlBottomProjLevels.allowEdit(false);
s = customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels));
if (customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Top)
{
SysQuery::findOrCreateRange(_query.dataSourceTable(tableNum(ProjTable)), fieldNum(ProjTable, ParentId)).value(SysQuery::valueEmptyString());
//ProjTable_ds.executeQuery();
//ProjTable_ds.query().dataSourceTable(tableNum(ProjTable)).clearRange(fieldNum(ProjTable, ParentId));
}
else if(customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Phase)
{
parentProjTableDataSource = _query.dataSourceTable(tableNum(ProjTable)).addDataSource(tableNum(ProjTable));//.addDataSource(tableNum(ProjTable)).addLink(fieldNum(ProjTable, ParentId),fieldNum(ProjTable, ProjId));
parentProjTableDataSource.joinMode(JoinMode::ExistsJoin);
parentProjTableDataSource.addLink(fieldNum(ProjTable, ProjId),fieldNum(ProjTable, ParentId));
parentProjTableDataSource2 = _query.dataSourceTable(tableNum(ProjTable)).addDataSource(tableNum(ProjTable));
parentProjTableDataSource2.joinMode(JoinMode::ExistsJoin);
parentProjTableDataSource2.addLink(fieldNum(ProjTable, ParentId),fieldNum(ProjTable, ProjId));
/* parentProjTableDataSource.enabled(false);
parentProjTableDataSource2.enabled(false);*/
}
else if(customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Bottom)
{
//CtrlBottomProjLevels.allowEdit(true);
parentProjTableDataSource = _query.dataSourceTable(tableNum(ProjTable)).addDataSource(tableNum(ProjTable));
parentProjTableDataSource.joinMode(JoinMode::NoExistsJoin);
parentProjTableDataSource.addLink(fieldNum(ProjTable, ProjId),fieldNum(ProjTable, ParentId));
parentProjTableDataSource.enabled(true);
//ProjTable_ds.executeQuery();
// parentProjTableDataSource.enabled(false);
}
else
{
SysQuery::findOrCreateRange(_query.dataSourceTable(tableNum(ProjTable)), fieldNum(ProjTable, ParentId)).value(SysQuery::valueUnlimited());
//ProjTable_ds.executeQuery();
}
if (_saveFilterValues)
{
//customFilter.setFilterControlValue(formControlStr(PurchReqTableListPage, PurchRequisitionerFilter), formControlValue(formStr(ProjProjectsListPage), formControlStrCtrlProjLevels));
customFilter.save();
}
return _query;
}
{
//QueryBuildDataSource parentProjTableDataSource, parentProjTableDataSource2;
int s;
//CtrlBottomProjLevels.allowEdit(false);
s = customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels));
if (customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Top)
{
SysQuery::findOrCreateRange(_query.dataSourceTable(tableNum(ProjTable)), fieldNum(ProjTable, ParentId)).value(SysQuery::valueEmptyString());
//ProjTable_ds.executeQuery();
//ProjTable_ds.query().dataSourceTable(tableNum(ProjTable)).clearRange(fieldNum(ProjTable, ParentId));
}
else if(customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Phase)
{
parentProjTableDataSource = _query.dataSourceTable(tableNum(ProjTable)).addDataSource(tableNum(ProjTable));//.addDataSource(tableNum(ProjTable)).addLink(fieldNum(ProjTable, ParentId),fieldNum(ProjTable, ProjId));
parentProjTableDataSource.joinMode(JoinMode::ExistsJoin);
parentProjTableDataSource.addLink(fieldNum(ProjTable, ProjId),fieldNum(ProjTable, ParentId));
parentProjTableDataSource2 = _query.dataSourceTable(tableNum(ProjTable)).addDataSource(tableNum(ProjTable));
parentProjTableDataSource2.joinMode(JoinMode::ExistsJoin);
parentProjTableDataSource2.addLink(fieldNum(ProjTable, ParentId),fieldNum(ProjTable, ProjId));
/* parentProjTableDataSource.enabled(false);
parentProjTableDataSource2.enabled(false);*/
}
else if(customFilter.getFilterControlValue(formControlStr(ProjProjectsListPage, CtrlProjLevels)) == ProjLevels::Bottom)
{
//CtrlBottomProjLevels.allowEdit(true);
parentProjTableDataSource = _query.dataSourceTable(tableNum(ProjTable)).addDataSource(tableNum(ProjTable));
parentProjTableDataSource.joinMode(JoinMode::NoExistsJoin);
parentProjTableDataSource.addLink(fieldNum(ProjTable, ProjId),fieldNum(ProjTable, ParentId));
parentProjTableDataSource.enabled(true);
//ProjTable_ds.executeQuery();
// parentProjTableDataSource.enabled(false);
}
else
{
SysQuery::findOrCreateRange(_query.dataSourceTable(tableNum(ProjTable)), fieldNum(ProjTable, ParentId)).value(SysQuery::valueUnlimited());
//ProjTable_ds.executeQuery();
}
if (_saveFilterValues)
{
//customFilter.setFilterControlValue(formControlStr(PurchReqTableListPage, PurchRequisitionerFilter), formControlValue(formStr(ProjProjectsListPage), formControlStrCtrlProjLevels));
customFilter.save();
}
return _query;
}
Comments
Post a Comment