The Compound Employee API offers a list of fields that can be used in the where clause of the query but it has certain limitations.
And while designing the query these must be considered.
The following limitations must be considered by the consumer:
- Expressions within the ‘WHERE’ clause can only be combined by the logical operator AND.
- The SNAPSHOT_DATE can only be compared with the value following the pattern to_datetime(<date value>) in format ‘YYYY-MM-DD"T"HH:MM:SS"Z"’. No other date formats are possible here.
- The EFFECTIVE_END_DATE can only be compared with the value following the pattern to_date(<date value>) in format ‘YYYY-MM-DD’. No other date formats are possible here.
- Unexpected results might be returned, if select parameters of effective dated segments (like EMPLOYEE_CLASS, DEPARTMENT, DIVISION or COMPANY_TERRITORY_CODE of segment (JOB_INFORMATION) are applied together with EFFECTIVE_END_DATE filter in a ‘WHERE’ clause.
- EFFECTIVE_END_DATE is used as a filter criterion of the result data. It is not used like the others as selection parameter (as a where condition in the SQL sense) to read data from data base.
- Filtering by EFFECTIVE_END_DATE applies to the result data and does not lead to a deletion of the employee; at least the segment person is kept in the query response. Therefore, it may happen that an employee is contained in the result set because the specified EMPLOYEE_CLASS is contained in one of the time slices of job_information which is, however, filtered out by the EFFECTIVE_END_DATE condition.
An example: Employees of EMPLOYEE_CLASS ‘Employee’ shall get selected; the result shall be filtered by EFFECTIVE_END_DATE.
SELECT person, personal_information, address_information, employment_information, job_information
WHERE employee_class = ‘Employee’ ORDER BY start_date ascending / descending </queryString>
The result is: The employee gets selected because it was once an employee; the current job is of EMPLOYEE_CLASS ‘Contractor’. The first and second job records get filtered by the EFFECTIVE_END_DATE filter.
Compound Employee API now also supports ascending and descending sorting by start date for effective dated entities, if the following expression is added in the where clause (in other words, ORDER BY will only work for effective-dated entities)
<queryString>SELECT person, personal_information, address_information, employment_information, job_information FROM CompoundEmployee WHERE employee_class = ‘Employee’ ORDER BY start_date ascending / descending </queryString>
Query response is:
Limitations of Compound Employee API field combinations supported in where clause , KBA , LOD-SF-INT-CE , Compound Employee API , LOD-SF-INT , Integrations , LOD-SF-INT-API , API & Adhoc API Framework , How To