Dears,
Hope every one doing well,
I want to retrieve all the active positions from e.g PositionTable, and add some ranges to it, in this table every position is linked to an organization.
I want to retrieve all positions with other organizations but only specified employee’s from organization (10) for example those employees whose positongroup is (aboveManger) will come from the organization (10) but from other organizations rest of them. how should I do it?
Here is my code:
Query query;
PositionId positionId;
QueryBuildDataSource qbds1,qbds2;
;
query=new query();
qbds1 = query.addDataSource(tablenum(PositionTable));
qbds2 = qbds1.addDataSource(tableNum(PositionTable));
qbds2.relations(false);
qbds2.joinMode(JoinMode::ExistsJoin);
qbds2.addLink(fieldnum(PositionTable,PositionId),fieldnum(PositionTable,ReportsToPosition));
qbds1.addRange(fieldnum(PositionTable,ValidFromDateTime)).value(QueryRange(DateNull(),SystemDateGet()));
qbds1.addRange(fieldnum(PositionTable,ValidToDateTime)).value(QueryRange(SystemDateGet(),DateNull()));
qbds2.addRange(fieldnum(PositionTable,ValidFromDateTime)).value(QueryRange(DateNull(),SystemDateGet()));
qbds2.addRange(fieldnum(PositionTable,ValidToDateTime)).value(QueryRange(SystemDateGet(),DateNull()));
I did the scenario like bellow but it is not working:
qbds2.addRange(fieldnum(PositionTable,OrganizationUnitId)).value(strFmt(’((%1.%2 == %5) && (%1.%3 == %4))’,
query.dataSourceTable(tableNum(PositionTable)).name(),
fieldStr(PositionTable, OrganizationUnitId),
fieldStr(PositionTable,EmployeeGroup),
any2int(PositonGroup ::MaangerAbvoe),10));
Thanks in advance!