Using expressions in queries to make complex ranges

Sometimes we cannot make a query fully represent what we want. For example OR statement can be very difficult. To achieve we can use strings to produce the range as described here. It is also worth remembering that there are a number of methods to help us build ranges, these can be found in the SysQuery and SysQueryRangeUtil classes. Most of these can also be used by the end users in grids and other objects. Here is a Microsoft article on using these that you can pass on.

Below is a job that is creating an OR statement on a query object using the above methods. We use methods on both classes to set our ranges and then use a string to create an or statement: