How to query multiple & optional CONTAINS

776 views
Skip to first unread message

Janik

unread,
May 4, 2016, 7:41:01 AM5/4/16
to AdWords Scripts Forum
Hi there,

I'm trying to query if an Ad (Headline/Description) contains one or more of several specific phrases.

The logic I'm trying to achieve is: WHERE FieldName CONTAINS ab or bc or cd

AWQL doesnt support OR though. So what would be a suitable workaround?

Thank you in advance!

Tyler Sidell (AdWords Scripts Team)

unread,
May 4, 2016, 9:50:26 AM5/4/16
to AdWords Scripts Forum
Hi Janik,

There is no OR condition in AdWords Scripts.  You could use CONTAINS_ANY instead.  That would mean that is can contain either ab or bc or cd.

Thanks,
Tyler Sidell
AdWords Scripts Team

Janik

unread,
May 4, 2016, 10:12:00 AM5/4/16
to AdWords Scripts Forum
Thank you for your answer.
But this is not documented anywhere... What is the syntax? 
CONTAINS_ANY ["ab","bc","cd"] ?

I'm getting a INVALID_PREDICATE_OPERATOR  error when using this with AD_PERFORMANCE_REPORT

Tyler Sidell (AdWords Scripts Team)

unread,
May 4, 2016, 10:25:34 AM5/4/16
to AdWords Scripts Forum
Hi Janik,

We do have documentation on CONTAINS_ANY but it can only be used for selectors and filtering StringSet variables.  Apologies but this cannot be used for report queries.  You would need to create separate queries for OR conditions.

Thanks,
Tyler Sidell
AdWords Scripts Team

john....@riseinteractive.com

unread,
Feb 6, 2018, 3:36:53 PM2/6/18
to AdWords Scripts Forum
Tyler - any change in this since 2016 or any way we can get this updated in a future release?

It would be very useful to be able to run a Contains_* search on the campaign name.

Adrian Catambay (AdWords Scripts Team)

unread,
Feb 6, 2018, 11:36:43 PM2/6/18
to AdWords Scripts Forum
Hello,

I am a colleague of Tyler and I will be responding to your inquiry in the mean time.

Currently, you can only use the CONTAINS_ALL []CONTAINS_ANY [], and CONTAINS_NONE [] operators on fields of type StringSet as specified in this documentation. You may follow our blog for any announcements in case there will be updates in this functionality.

Thanks,
Adrian
AdWords Scripts Team
Reply all
Reply to author
Forward
0 new messages