- Courses
- ItemPath API
- Section 3: Using Comparison Operators
- "Like" & "Not Like" Operators: [like] & [notlike]
"Like" & "Not Like" Operators: [like] & [notlike]
These operators act similarly to a search function. Technically speaking:
- [like] checks for any values containing the data
- [notlike] checks for values that do not contain the data
In this example, we want to get a list of materials with the word "valve" in their descriptions. We can use the [like] operator to reach for the string:
/materials?Info1=[like]valve
Let's say you're also using the Info1 field to make notes of any materials created for testing purposes. You could use the [notlike] filter to exclude any materials containing the word "test," like this:
/materials?Info1=[notlike]test
Note: In addition to excluding results where the field contains certain data, the [notlike] filter will also exclude results where the value is "null." You'll want to keep this in mind when searching fields that aren't required.
In this scenario, you could return a list of materials that have "null" Info1 values like this:
/materials?Info1=null