Multiple Conditions in the Same Grid Request

It is possible to use multiple conditions to form more complex requests with the Informz API. A couple ground rule before attempting to form complex conditions would be:

  • Each condition’s <DataElement> can only appear once in the grid request; otherwise they will be in conflict with each other and no return fields will be present.
  • Be sure that each condition get’s its own <Condition> parent tag.
  • It is best to work “Large to Small," having the expectation that fewer records return as more conditions are added to the Grid Request.

Below are three examples of these complex conditions working together:

Example 1: Inclusive Conditions

The below example is a GridRequest that is trying to pull tabular data from subscriber_personal_information using “inclusive conditions”, or conditions that work to get information based on the conditions being supplied appearing in the response. In this request, we are looking for all personal information for three separate Subscriber_ID’s, including three Personal_Information_ID’s that we wanted included, and then including an additional condition to return data related to items where the personal_information_name is equal to “First Name”. This is not the most useful grid request (since the third condition pretty much makes the second condition useless), but it does illustrate how conditions can work together to narrow down on what is important:

<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/">
 <Password>password</Password>
 <Brand id="9999">Brand Name</Brand>
 <User>test_user</User>
 <Grids>
  <Grid type="subscriber_personal_information">
   <Conditions>
    <Condition>
     <Collection>
      <DataElement>Subscriber_ID</DataElement>
      <DataValue>521698050</DataValue>
      <DataValue>522355847</DataValue>
      <DataValue>522355874</DataValue>
      <SetOperator>IN</SetOperator>
     </Collection>
    </Condition>
    <Condition>
     <Collection>
      <DataElement>Personal_Information_ID</DataElement>
      <DataValue>1057</DataValue>
      <DataValue>1058</DataValue>
      <DataValue>1049</DataValue>
      <SetOperator>IN</SetOperator>
     </Collection>
    </Condition>
    <Condition>
     <Collection>
      <DataElement>Personal_Information_name</DataElement>
      <DataValue>First</DataValue>
      <SetOperator>IN</SetOperator>
     </Collection>
    </Condition>
   </Conditions>
   <ReturnFields>
    <DataElement>subscriber_id</DataElement>
    <DataElement>Email</DataElement>
    <DataElement>personal_information_id</DataElement>
    <DataElement>personal_information_name</DataElement>
    <DataElement>personal_information_value</DataElement>
   </ReturnFields>
  </Grid>
 </Grids>
</GridRequest>

Example 2: Subscriber Interests

The following request seeks data contingent upon both “inclusive conditions” and “non-inclusive/negative” conditions. The idea is to request data that has some given criteria, while removing items from that data that is not important to what we’re hoping to see in the response. In the below request, we want to request of all subscribers who were brought into Informz after December 31, 2015, we want to omit two Informz users who were added after that date that would otherwise appear as subscribers in the response, and we want to also omit unsubscribers.

<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/">

 <Password>password</Password>
 <Brand id="9999">Brand Name</Brand>
 <User>test_user</User>
  <Grids>
  <Grid type="subscriber">
   <Conditions>
    <Condition>
     <Single>
      <DataElement>service_since_date</DataElement>
      <DataValue>2015-12-31</DataValue>
      <Comparator>GT</Comparator>
     </Single>
    </Condition>
    <Condition>
     <Collection>
      <DataElement>email</DataElement>
      <DataValue>new_admin_user1@example.com</DataValue>
      <DataValue>new_admin_user2@example.com </DataValue>
      <SetOperator>NOTIN</SetOperator>
     </Collection>
    </Condition>
    <Condition>
     <Single>
      <DataElement>is_unsubscriber</DataElement>
      <DataValue>1</DataValue>
      <Comparator>NEQ</Comparator>
     </Single>
    </Condition>
   </Conditions>
   <ReturnFields>
    <DataElement>email</DataElement>
    <DataElement>is_unsubscriber</DataElement>
   </ReturnFields>
  </Grid>
 </Grids>
</GridRequest>

Example 3: Mailing

The following requests data that should include mailings that were sent between two given dates. In addition, the request omits any mailings that contain a given subject.

<GridRequest xmlns="http://partner.informz.net/aapi/2009/08/">
 <Password>password</Password>
 <Brand id="9999">Brand Name</Brand>
 <User>test_user</User>
  <Grids>
  <Grid type="mailing">
   <Conditions>
    <Condition>
     <Between>
      <DataElement>create_date</DataElement>
      <DataValue>2014-12-31</DataValue>
      <DataValue>2016-04-25</DataValue>
     </Between>
    </Condition>
    <Condition>
     <Single>
      <DataElement>subject</DataElement>
      <DataValue>This is my test email</DataValue>
      <Comparator>NEQ</Comparator>
     </Single>
    </Condition>
   </Conditions>
   <ReturnFields>
    <DataElement>create_date</DataElement>
    <DataElement>folder_id</DataElement>
    <DataElement>friendly_from</DataElement>
    <DataElement>mailing_id</DataElement>
    <DataElement>name</DataElement>
    <DataElement>reply_to</DataElement>
    <DataElement>subject</DataElement>
    <DataElement>template_name</DataElement>
   </ReturnFields>
  </Grid>
 </Grids>
</GridRequest>