hi

im trying to get a report with a predicate that filters to all the 
campaigns belonging to an account: 
[code]
// create selector
        Selector selector = new Selector();
        selector.getFields().addAll(reportFields);

        // Create status = active predicate
        if(status != null) {
            Predicate statusPredicate =    new Predicate();
            statusPredicate.setField("Status");
            statusPredicate.setOperator(PredicateOperator.EQUALS);
            statusPredicate.getValues().add("ACTIVE");
            // add predicate
            selector.getPredicates().add(statusPredicate);
        }

        // Create account predicate
        Predicate accountPredicate = new Predicate();
        accountPredicate.setField("AccountId");
        accountPredicate.setOperator(PredicateOperator.EQUALS);
        
accountPredicate.getValues().add(String.valueOf(account.getClientId()));
        // add predicate
        selector.getPredicates().add(accountPredicate);

        // create report definition
        ReportDefinition reportDefinition = new ReportDefinition();
        reportDefinition.setReportName("CAMPAIGN_PERFORMANCE_REPORT #" + 
System.currentTimeMillis());
        
reportDefinition.setDateRangeType(ReportDefinitionDateRangeType.TODAY);
        
reportDefinition.setReportType(ReportDefinitionReportType.CAMPAIGN_PERFORMANCE_REPORT);
        reportDefinition.setDownloadFormat(DownloadFormat.CSV);
        reportDefinition.setSelector(selector);

        // construct an AdWordsSession
        AdWordsSession session = null;
        try {
            session = new AdWordsSession.Builder()
            .withClientLoginToken(clientLoginToken)
            .withDeveloperToken(developerToken)
            .withClientCustomerId(account.getClientId())
            .withEnvironment(Environment.PRODUCTION).build();
        } catch (ValidationException e1) {
            e1.printStackTrace();
        }

        // download keyword report
        int numberOfRetries = 0;
        while(true) {
            try {
                return new 
ReportDownloader(session).downloadReport(reportDefinition);
            } catch (ReportException e) {
                e.printStackTrace();
                if(numberOfRetries < 10) {
                    numberOfRetries++;
                    continue;
                } else {
                    break;
                }
            } catch (ReportDownloadResponseException e) {
                e.printStackTrace();
                break;
            }
        }
[/code]

I do get an error in ReportDownloadResponseException: 
HTTP Response Code: 400, FieldPath: selector, Trigger: 111-081-1181, Type: 
SelectorError.INVALID_PREDICATE_VALUE
    at 
com.google.api.ads.adwords.lib.utils.v201209.ReportDownloader.handleResponse(ReportDownloader.java:119)
    at 
com.google.api.ads.adwords.lib.utils.v201209.ReportDownloader.downloadReport(ReportDownloader.java:93)

It works like a charm when i leave the accountPredicate out. 
Ive also Tried replacing the "-" of the accountId with empty strings but 
its the same.

But according to the reference a CAMPAIGN_PERFORMANCE_REPORT does have an 
AccountId field.

What am i doing wrong? Thank you for any help

greez

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to