Search Content


Content Categories



ExactTarget API tip - complex filters

A couple of weeks ago I was at a client site doing ExactTarget API consulting. This client is standardizing on ExactTarget as their single source of all e-mail communications from three of their internal applications. They will use 5Buckets for the automation in certain cases, but also needed to develop their own integration with ExactTarget directly.

One of the developers posed me a question about “filters” in the ExactTarget web service. You can use
simplefilterpart() to specify what data point you want to filter on, and of course the value. For example, to filter on CustomerKey -


SimpleFilterPart sfp = new SimpleFilterPart();
sfp.Property = “CustomerKey”;
sfp.SimpleOperator = SimpleOperators.equals;
sfp.Value = new string[] { “TransactionalSendKey” };

Here you are first creating an instance of SimpleFilterPart. Then indicating that you want to filter using “CustomerKey”, indicating the operator and finally the value of the CustomerKey.

Now, if you have two filter criteria, you create two instances of the SimpleFilterPart and join the two using ComplexFilterPart (see code example in the Webserivces API guide, pg. 36)

Going back to the question that came up at client site - they wanted to know how they would add a third filter criteria. Well, it’s simple enough. Create a third instance of SimpleFilterPart and set the property and values as appropriate. Then create another instance of a ComplexFilterPart and assign you first ComplexFilterPart to the LeftOperand and the third SimpleFilterPart to the RightOperand.


ComplexFilterPart ComplexFilter2 = new ComplexFilterPart();
ComplexFilter2.LeftOperand = ComplexFilter1;
ComplexFilter2.LogicalOperator = LogicalOperators.AND;
ComplexFilter2.RightOperand = ThirdSimpleFilterPart;




Related Qualifying Sales Leads Articles

Cross Salesforce.com and Amazon S3?


You get Appirio Cloud Storage for Salesforce.com, a new SaaS offering from Appirio that taps Amazon S3 to extend the storage capabilities of Salesforce.com. (We toyed with calling it SalAmaForce3 but didn't really see that...

Read more about Cross Salesforce.com and Amazon S3?...

PaaS Magic from Coda with Google Apps and Force.co


The value of platform as a service (PaaS) is not that you can take your on-premise applications and run them in the cloud - that's so ASP! In my opinion (and what would a blog be without one), the real value is in enabling functionality that was...

Read more about PaaS Magic from Coda with Google Apps and Force.com...