Custom query language reference
To implement the DataIO.Version6.SearchRecords action, you must translate a query expression from the Docusign custom query language into one supported by your external system. Docusign established this custom language in order to maintain flexibility without depending on any specific external system. This reference page shows how the query objects are structured.
- IQuery object
- IQueryFilter object
- IComparisonOperation object
- IOperand object
- ILogicalOperation object
You can also see an Example of how to use build a query using these objects.
Note that each object contains a $class property that identifies its type. This enables your API proxy to recognize the object type and transform it to the associated type in a different query language.
Reference
IQuery object
The IQuery object represents a query of the external system. The query:
- Selects the properties specified by
attributesToSelect... - From the table specified by the from
property... - And then filters the records based on the
queryFilter
IQueryFilter object
The IQueryFilter object wraps a comparison operation or logical operation.
IComparisonOperation object
Compares a value from the data table to a constant.
IOperand object
This object represents an operand to use in a comparison. It can either be a value selected from the table in the external system of record, or a literal value.
ILogicalOperation object
This object combines two operations in a logical AND/OR statement. Each suboperation is an IComparisonOperation or ILogicalOperation.
Example
To understand the schema, construct a query to select all Dog records for which the dog is 8 or older and the dog’s name starts with “Francis”. (To implement the search action, you’ll need to perform the opposite transformation: from IQuery to your own system’s query language. But this is a useful exercise for understanding.)
Start by setting the root values. The external service has a table for all Dog objects. The Dog type has properties age and animalName, which you will use in your query. So the root of the query object will look like this:
Now construct the queryFilter. The base operation is a logical AND statement, because you want records for which the dog’s age is greater than or equal to 8 AND the dog’s name starts with “Francis”. Represent this by setting the operation parameter to a ILogicalOperation object.
Next, write the leftOperation to check the dog’s age. This is a comparison, so use an IComparisonOperation object.
The first operand is an IOperand object representing the dog’s age. Remember that the query will select that value from the table. Indicate the name with the dogName value from the attributesToSelect list. Set type to whatever the data type is in the table. Finally, set isLiteral to false, because this is not a constant value.
For the operator, refer to the possible values in the IComparisonOperation schema. You want to check if the dog’s age is greater than or equal to 8, so use the GREATER_THAN_OR_EQUALS_TO value.
The second operand is a constant value of 8. Set the value in the name field, and set isLiteral to true, because it’s a constant.
Finally, construct the rightOperation. Again, this is a comparison, so use an IComparisonOperation object. The only difference from the leftOperation is that you are using a string, not an integer, and using the STARTS_WITH operator. This is the final JSON:
Your completed query construction should look like the following: