WHERE ON
Specifies the fields to filter from related business objects (RBOs) in the SELECT clause. Workday evaluates expressions in parentheses first in conditional expressions. Use the
AND
and OR
logical operators to separate conditional expressions in Workday Query Language (WQL).Syntax
WHERE ON relatedBusinessObject1 relatedBusinessObjectField1 = value1 AND relatedBusinessObjectField2 IN (instance1, instance2) OR relatedBusinessObjectField3 IN (inst_refId = referenceID) WHERE ON relatedBusinessObject2 relatedBusinessObjectField1 = value1
Omit the braces { } notation for RBO fields.
Arguments
Argument | Description |
|---|---|
relatedBusinessObject1
| The RBO of the fields for which you want to filter results. |
relatedBusinessObjectfield1 , relatedBusinessObjectfield2 , ...relatedBusinessObjectfieldN
| The fields of the related business objects for which you want to filter results. |
value1 , value2 , ...valueN
| The values of the fields you want to match. |
instance1 , instance2 , ...instanceN
| The Workday IDs of the field values you want to match. Workday fails queries with invalid ID formats. |
inst_refId
| The reference ID type of a field in the conditional expression. |
referenceID
| The reference ID of the field value you want to match. You can filter by the reference ID with or without double quotes. Examples:
|
Comparison Operators
Operator | Field Data Type Compatibility | Description |
|---|---|---|
= | Boolean Date Numeric Text | Equal. |
> | Date Numeric | Greater than. |
>= | Date Numeric | Greater than or equal to. |
< | Date Numeric | Less than. |
<= | Date Numeric | Less than or equal to. |
!= | Boolean Date Numeric Text | Not equal. |
contains | Text | The comparison value is a subset of the field value. Case insensitive. Example:
Cat contains AT. |
not contains | Text | The comparison value isn't a subset of the field value. Case insensitive. Example:
Cat doesn’t contain dog. |
endswith | Text | The comparison value is a subset of field value. The last character of the field value matches the last character of the comparison value. Case insensitive. Example:
Cat ends with AT. |
in | Instance Text | The field matches 1 or more possible values for a condition. |
is empty | Boolean Date Instance Numeric Text | The field has no value. |
is not empty | Boolean Date Instance Numeric Text | The field has a value. |
not in | Instance Text | The field doesn't match any possible values for a condition. |
startswith | Text | The comparison value is a subset of the field value. The first character of the field value matches the first character of the comparison value. Case insensitive. Example:
Cat starts with CA. |
Date and Time Formats
WQL supports dates and datetimes in Coordinated Universal Time (UTC) or Pacific Standard Time (PST).
Date and Time | Format |
|---|---|
Date | YYYY-MM-DD |
Time (24-hour clock) | HH:MM:SS |
Datetime with time zone | PST: YYYY-MM-DD HH:MM:SS
UTC: YYYY-MM-DD HH:MM:SSZ |
Examples
Return results from the
allWorkers
data source and location
RBO by workers who:
- Are over 50.
- Work more than 23 hours.
SELECT worker, location{addresses}, age FROM allWorkers WHERE ON location addresses is NOT EMPTY WHERE defaultWeeklyHours > 23 AND age > 50
Return results from the
allWorkers
data source and location
and dependents
RBOs by workers whose:
- Pay is a currency specified by a Workday ID.
- Dependents' last names start with the letter N.
- Age is over 50.
- Location is in 2 specific cities.
SELECT worker, location{addresses}, dependents{legalName_LastName}, age FROM allWorkers WHERE ON location addresses is NOT EMPTY AND currency in (9e996ffdd3e14da0ba7275d5400bafd4) WHERE ON dependents legalName_LastName startswith "N" WHERE age > 50 OR location in (043e71ed793b1054de6213435945000c, d13a7c46a06443c4a33c09afbdf72c73)
Limitations
WHERE ON clauses must go before WHERE clauses.