How to add more then one predicates in selector

16 views
Skip to first unread message

Eshwar Chettri

unread,
Mar 7, 2017, 1:26:51 AM3/7/17
to AdWords API Forum
Hi,
  I want to know hoe can i add Two predicate fields in selector. Below is the code how i tried but only one is getting set to selector.
 
            Predicate idsPredicate = new Predicate("Id", PredicateOperator.IN, seIds);
            Predicate idsPredicate1 = new Predicate("Status", PredicateOperator.IN,new String[]{"ENABLED","PAUSED","REMOVED"});
            selector.setPredicates(new Predicate[]{idsPredicate1});
            selector.setPredicates(new Predicate[]{idsPredicate});
            selector.setFields(selectedFields);

Peter Oliquino

unread,
Mar 7, 2017, 2:27:12 AM3/7/17
to AdWords API Forum
Hi Eshwar,

Could you confirm if you are using the Java client library? If yes, you may try using something like the code below :
Predicate idsPredicate = new Predicate();
idsPredicate.setField("Id");
idsPredicate.setOperator(PredicateOperator.IN);
idsPredicate.setValues(seIds);
Predicate idsPredicate1 = new Predicate();
idsPredicate1.setField("Status");
idsPredicate1.setOperator(PredicateOperator.IN);
idsPredicate1setValues(new String[]{"ENABLED","PAUSED","REMOVED"});
selector.setFields(new String[] { "Id", "Status" });
selector.setPredicates(new Predicate[]{idsPredicate, idsPredicate1});
Let me know if this works.

Best regards,
Peter
AdWords API Team
Reply all
Reply to author
Forward
0 new messages