predicate examples

310 views
Skip to first unread message

chris h

unread,
Jul 5, 2010, 9:51:32 PM7/5/10
to AdWords API Forum
I'm looking for examples using the different predicate operators and
can find none. Where are they?

adwordsa...@google.com

unread,
Jul 6, 2010, 1:21:39 AM7/6/10
to adwor...@googlegroups.com
Hi Chris,

http://code.google.com/p/google-api-adwords-java/source/browse/trunk/examples/v201003/AddKeywordsPerformanceReportDefinition.java shows the use of PredicateOperator.EQUALS. The usage of other operators are similar.

Cheers,
Anash P. Oommen,
AdWords API Team

chris h

unread,
Jul 6, 2010, 1:13:56 PM7/6/10
to AdWords API Forum
Thanks. How about IN and NOT_IN. I assume they compare against a set.
Could you show how they are used?

- Chris


On Jul 6, 1:21 am, adwordsapiadvi...@google.com wrote:
> Hi Chris,
>
> http://code.google.com/p/google-api-adwords-java/source/browse/trunk/...

chris h

unread,
Jul 6, 2010, 1:16:12 PM7/6/10
to AdWords API Forum
Also, are values always strings? even when field is of another type?

AdWords API Advisor

unread,
Jul 7, 2010, 2:09:05 PM7/7/10
to AdWords API Forum
Hi Chris,

The values are always passed as strings, as defined in the Predicate
object:

http://code.google.com/apis/adwords/v2009/docs/reference/ReportDefinitionService.Predicate.html

Best,
- Eric Koleda, AdWords API Team

chris h

unread,
Jul 7, 2010, 2:51:40 PM7/7/10
to AdWords API Forum
Eric,

If a list of predicates is supplied, are the ANDed together?

meta-question: where would I find the answer to that in the
documentation?

Thanks,
Chris

On Jul 7, 2:09 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> Hi Chris,
>
> The values are always passed as strings, as defined in the Predicate
> object:
>
>  http://code.google.com/apis/adwords/v2009/docs/reference/ReportDefini...

AdWords API Advisor

unread,
Jul 7, 2010, 4:52:25 PM7/7/10
to AdWords API Forum
Hi Chris,

Yes, the rows must match all predicates to be returned in the report.
This information currently isn't contained in the documentation, but
it should likely appear within the Selector.predicates documentation.
I'll work with the documentation team to ensure this is updated.

Best,
- Eric

chris h

unread,
Jul 7, 2010, 10:56:56 PM7/7/10
to AdWords API Forum
I think it would be useful to support a logical OR between predicates.
Not sure how it would be expressed using current API semantics. Am I
overlooking a way to achieve the same thing using the API is it
stands?
- Chris

On Jul 7, 4:52 pm, AdWords API Advisor <adwordsapiadvi...@google.com>

AdWords API Advisor

unread,
Jul 8, 2010, 6:26:10 PM7/8/10
to AdWords API Forum
Hi Chris,

There currently isn't the ability to OR together two different
predicates. However, for using OR logic on different values of the
same field you can take advantage of the values array and the IN
operator.

AdGroupId IN (12345, 67890)

Is there a use case you have in mind where you would need to OR
predicates?

Best,
- Eric

chris h

unread,
Jul 8, 2010, 9:39:24 PM7/8/10
to AdWords API Forum
ORing together STARTS_WITH or CONTAINS is a common use case.

On Jul 8, 6:26 pm, AdWords API Advisor <adwordsapiadvi...@google.com>

AdWords API Advisor

unread,
Jul 9, 2010, 5:28:21 PM7/9/10
to AdWords API Forum
Hi Chris,

Thanks, I'll pass that on to the core engineering team for
consideration.

Best,
- Eric
Reply all
Reply to author
Forward
0 new messages