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/ddfe2d8b-8836-41dd-95a5-8c2926591654%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to