$user->LoadService("ReportDefinitionService");
$selector = new Selector();
$selector->fields = $report["fields"];
$selector->dateRange = new DateRange($api_date, $api_date);
$selector->withCondition = "Name STARTS_WITH 'CTC'";
$reportDefinition = new ReportDefinition();
$reportDefinition->reportName = 'my_made_up_name_' . time();
$reportDefinition->dateRangeType = "CUSTOM_DATE";
$reportDefinition->reportType = $report["type"];
$reportDefinition->downloadFormat = "GZIPPED_CSV";
$reportDefinition->selector = $selector;
I am trying to limit the campaigns that I get back in the report so that I only get those starting with 'CTC'.
$selector->withCondition = "Name STARTS_WITH 'CTC'";
I am not sure if I have the syntax wrong I am using this page as a reference https://developers.google.com/adwords/scripts/docs/reference/adwordsapp_campaignselector#withCondition_1
The error I am getting back is:
An error has occurred: Report download failed. Underlying errors are Type = 'ReportDownloadError.INVALID_REPORT_DEFINITION_XML', Trigger = 'Invalid ReportDefinition Xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'withCondition'. One of '{" https://adwords.google.com/api/adwords/cm/v201306 ":ordering, " https://adwords.google.com/api/adwords/cm/v201306 ":paging}' is expected.', FieldPath = ''.
Thanks in advance,
James
$selector = new Selector();
$selector->fields = $report["fields"];
$selector->dateRange = new DateRange($api_date, $api_date);
//$selector->withCondition = "Name STARTS_WITH 'CTC'";
$selector->predicates[] = new Predicate('CampaignName', 'STARTS_WITH', 'CTC');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.