Introduction

To retrieve a well-defined set of records, files or other objects from within Aprimo DAM you can use search expressions. Below are examples of the different syntaxes you can use when searching for objects in Aprimo DAM.

Simple search expressions

The most simple search expression is property=value, which looks for all objects that match the specified property value, e.g. this query will retrieve and load all users whose name is “Administrator”:

Name = Administrator

In case the value of the field or property contains spaces, enclose the value in single or double quotes.

This second query combines 2 search criteria into one search expression: it loads all users whose name starts with an “a” (using the * wildcard) and who were created by a user named “John Doe” (via the CreatedBy property, which in turn contains a user object). Note that the name John Doe is enclosed in single quotes because of the included space:

Name = a* AND CreatedBy.Name = 'John Doe'"

Using named and unnamed parameters

To simplify dynamically building search expressions in code, the advanced search REST API endpoint also supports searching used named or unnamed parameters.

An unnamed parameter is a parameter that is identified using a question mark (?). These parameters are processed in the same order as they are specified in the search expression. So if you want to use the same value multiple times in an expression, you’ll also have to specify this parameter multiple times.

A named parameter is a parameter that starts with an @, e.g. @Name. Named parameters have the disadvantage that they are slightly more work to specify, but they make it easier to reuse the same parameter value and you can even ask Aprimo DAM to create a list of all the parameters specified in a search expression.

The first example loads all users whose name is “John Doe”, using 1 unnamed parameter:

{
	"searchExpression":
	{
		"expression": "Name = ?",
		"parameters": ["John Doe"],
	}
}

This example loads all users whose name begins with “a” or “b”, using 2 unnamed parameters:

{
	"searchExpression":
	{
		"expression": "Name=? OR Name=?",
		"parameters": ["a*", "b*"]
	}
}

This search expression looks for all users whose name or e-mail address is “John Doe”, using a named parameter “Word”:

{
	"searchExpression":
	{
		"expression": "Name = @Word OR Email = @Word",
		"namedParameters": {"Word" = "John Doe"}
	}
}

Working with operators and wildcards

Supported search operators

To define the relationship between the searchable property and the corresponding value, you can use these relational operators:

Operator Description Example
= is equal to
 CreatedBy.Name = "Pete Newcase"
> is greater than or after
 FileCount > 0
>= is greater than or equals
 FileCount >= 1
< is less than or before
 CreatedOn < 05/05/2015
<= is less than or equals
 CreatedOn <= 05/05/2015
<> is not equal to
 File.CheckedOutOn <> 05/05/2015
in matches one of

Use to match the property or field value to one of the listed values

The file count of the record is either 1, 3 or 5:

 FileCount in '"1","3","5"'

User was created by Pete, Laura or James:

 CreatedBy.Name in '"Pete","Laura","James"'

Record was created today:

 CreatedOn in today
contains contains

Search through value of the property or field using the full-text index, only available on records and classifications.

Find all records for which the Comment property on a file version contains draft:

 File.Version.Comment contains "draft"

Depending on the data type of the property or field that you use in your search expression, you can use different operators.

Data Type Supported Operators
String =   >   >=   <   <=   <>   contains* in
Date/Time =   >   >=   <   <=   <>   in
(only the keyword today is supported with the in operator)
Guid =   <>   in
Numeric =   >   >=   <   <=   <> in
Boolean =   <>

*: the contains operator searches the full-text index, which means it’s only supported on full-text indexed objects: records and classifications.

 

Combining search expressions

A search expression can contain the following logical search operators: AND, OR, NOT and parentheses. An AND can also be replaced by a plus sign and a NOT by a minus sign. You can use these search operators to combine separate search expressions into a single complex expression. Just as you would combine search terms using logical operators, you can do the same for search expressions.

Aprimo DAM supports these logical operators:

Operator Used to …
AND (+) combine search expressions, search results must match both expressions
OR combine search expressions, search results must match either expression
NOT (-) combine search expressions, search results must match expression before operator but NOT the expression after the operator

In case you don’t write a correct search expression, Aprimo DAM will attempt to correct any faults in the specified expression, e.g. every time an operator is missing, Aprimo DAM will automatically use the AND operator, but you can make Aprimo DAM use another operator by using the defaultLogicalOperator parameter when searching with the REST API.

The following example makes Aprimo DAM use OR instead, looking for all users whose name begins with “a” or “b”:

{
	"searchExpression":
	{
		"expression": "Name = ? Name = ?",
		"parameters": ["a*", "b*"],
		"defaultLogicalOperator": "OR"
	}
}

You can also use the IN operator. The following sample loads all users whose ID matches one of the IDs in the list, using the IN operator:

{
	"searchExpression":
	{
		"expression": "Id IN ?",
		"parameters": [	"117c5ef4-5505-435e-818f-0495ea434a8c,
				2fa2ba22-8ae0-481b-a4fe-1d4c0edab6e3,
				503dfa3a-debc-4add-96cf-da4d62feb13a"]
	}
}

Wildcards

An * (asterisk) in a search expression is interpreted as a wildcard. This example looks for all users whose name starts with an “a”:

Name = a*

You could however disable the use of wildcards by setting the supportWildcards parameter in the REST API.

The example below will load all users whose name is literally equal to “a*” :

{
	"searchExpression":
	{
		"expression": "Name = a*",
		"supportWildcards": "false"
	}
}