Hi,

When using AWQL, you cannot create nested conditions as you described 
below. Therefore, you would need to submit two requests:

1. WHERE Status != REMOVED AND Name CONTAINS 'General campaign'
2. WHERE Status != REMOVED AND Name CONTAINS 'Campaign #'

As an alternative you could label your campaigns, and then use labels in 
your report predicates. See our Labels Guide 
<https://developers.google.com/adwords/api/docs/guides/labels> for details.

Thanks,
Josh, AdWords API Team

On Friday, March 27, 2015 at 11:54:12 AM UTC-4, Евгений Мотуз wrote:
>
> HI!
> Please, help me with AWQL
> How can i make request like:
> SELECT Id, Name, Status WHERE Status != "REMOVED" AND ( Name CONTAINS 
> "General 
> campaign"  OR Name CONTAINS "Campaign #" OR ...N ) ORDER BY Id
>
> "General campaign" and "Campaign #" it is part of campaign name (full 
> name is General campaign (#45)_1,  General campaign (#45)_2, General 
> campaign (#45)_2 ...) .
>
> My code is:
> public function getCampaignsWithCounters(array $campName)
>     {
>
>         $awqlInsert = 'AND ( ';
>         $insert = FALSE;
>         foreach($campName as $cmp)
>         {
>             if($insert)
>                 $awqlInsert.=' OR ';
>             else
>                 $insert = TRUE;
>             $awqlInsert.= ' Name CONTAINS "'.$cmp.'"';
>         }
>         $awqlInsert.= ' )';
>
>         $result = [];
>         $campaignService = $this->_user->GetService('CampaignService');
>         $query = 'SELECT Id, Name, Status WHERE Status != "REMOVED" 
> '.$awqlInsert.' ORDER BY Id';
>         // Create paging controls.
>         $offset = 0;
>         do {
>             $pageQuery = sprintf('%s LIMIT %d,%d', $query, $offset,
>                 \AdWordsConstants::RECOMMENDED_PAGE_SIZE);
>             $page = $campaignService->query($pageQuery);
>             if (isset($page->entries)) {
>                 foreach ($page->entries as $campaign) {
>                     $result []= [
>                         'name' => $campaign->name,
>                         'cmpID' => $campaign->id
>                     ];
>                 }
>             } else {
>                 $result = [];
>             }
>             $offset += \AdWordsConstants::RECOMMENDED_PAGE_SIZE;
>         } while ($page->totalNumEntries > $offset);
>
>         return $result;
>     }
>
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/93db90d1-8edc-4d47-9e67-63c09f8c52c8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • AWQL query. Евгений Мотуз
    • Re: AWQL query. Josh Radcliff (AdWords API Team)

Reply via email to