Custom Query Example

The following example uses the Filters tab to select all active accounts in three states: MA, NH, and ME. The SQL equivalent of this is:

…where Active_c =’Y’ and (BillingState=’MA’ or BillingState=’NH’ or BillingState=’ME’)

  1. If you want to create a filter condition for the Active__c field, click Add Condition.
  2. If you want to create a filter condition for BillingState field, click Add Condition.

    Select "BillingState” from the Field list, select "=” from the Comparison Operator list, then type "MA” (again, with double quotes — all strings must include double quotes), then click OK.

    Notice in the tree control on the Filters tab that you now have an Account node with an "and” node below it, and the two conditions that you just created nested below the "and” node. This tells you that the results of the "Active__c” and "BillingState” conditions will be "anded” together.

  3. Add the other two conditions for NH and ME. Because we want to include Account records from the 3 different states, we want to create a set of "or” conditions. To do this:

     

     

  4. With the "or” node selected, add two additional BillingState conditions for "NH” and "ME” as described in step 2 above. The resulting filter will be displayed as:

    Note: Another way to create this filter would be to add all 4 of the conditions under the "and” node, multiselect the 3 BillingState conditions, then click the Operator radio button labeled "or”.

See also

Creating an Insight Custom Query

Filters tab