Hi Sergey,

The structure from your original request was:

operator = AND
lhsOperand = 
  [ 
    DEVICE_PLATFORM EQUALS Desktop,
    Function {
      operator = AND
      lhsOperand = 
        [
          Attribute ID 1 EQUALS 'bn',
          Attribute ID 9 CONTAINS_ANY ('cat 1', 'cat 2', 'cat 3')
        ]
    }
  ]

This translates to the following:

DEVICE_PLATFORM = 'Desktop' AND ((Attribute ID 1 = 'bn' AND Attribute ID 9 
IN ('cat 1', 'cat 2', 'cat 3')))

I think that the issue is that you can't *AND* a *RequestContextOperand* 
(DEVICE_PLATFORM) with anything but a *single level* function on 
*FeedAttributeOperand*.

The good news is that you can remove one level of nesting, since the 
following is logically equivalent to your function:

DEVICE_PLATFORM = 'Desktop' AND (Attribute ID 1 = 'bn' AND Attribute ID 9 
IN ('cat 1', 'cat 2', 'cat 3'))

This is equivalent because:

A AND (B AND C) is equivalent to A AND B AND C.

This translates to:

operator = AND
lhsOperand = 
  [ 
    DEVICE_PLATFORM EQUALS Desktop,
    Attribute ID 1 EQUALS 'bn',
    Attribute ID 9 CONTAINS_ANY ('cat 1', 'cat 2', 'cat 3')
  ]

Could you give that a try and let me know if you still encounter issues?

Thanks,
Josh, AdWords API Team

On Thursday, March 26, 2015 at 8:35:57 AM UTC-4, Josh Radcliff (AdWords API 
Team) wrote:
>
> Hi Sergey,
>
> Very sorry, you are absolutely correct. I was mistaken in my original 
> comment. On *AND* combinations, you should put all operands in 
> *lhsOperand*, as you were doing.
>
> I'll take another look at this and get back to you.
>
> Thanks,
> Josh, AdWords API Team
>
> On Thursday, March 26, 2015 at 5:51:36 AM UTC-4, Sergey Petrov wrote:
>>
>> Hi Josh, 
>> I am a bit confusing with your first comment because following by 
>> documentation 
>> <https://developers.google.com/adwords/api/docs/reference/v201502/CustomerFeedService.Function?hl=ru>
>>  
>> : 
>>
>> ========================================================================================
>> ANDOperator that takes two or more operands that are of type 
>> FunctionOperand and checks that all the operands evaluate to true. All the 
>> operands must be in lhsOperand. Return ConstantOperand with Bool type.
>>
>> ========================================================================================
>>
>> What do you think about that  ? 
>>
>> среда, 25 марта 2015 г., 20:28:53 UTC+2 пользователь Sergey Petrov 
>> написал:
>>>
>>> Hi Josh ! 
>>>
>>> Fantastic catch ! Thank you for response. I fix the request to have lhs 
>>> and rhs for each function but currently get another 
>>> problem: FunctionError.INVALID_NUMBER_OF_OPERANDS
>>> Did I miss something ? 
>>>
>>> reguest bellow
>>>
>>>                 <operand>
>>>                     <feedId>23947372</feedId>
>>>                     <campaignId>248364018</campaignId>
>>>                     <matchingFunction>
>>>                         <operator>AND</operator>
>>>                         <lhsOperand xsi:type="ns2:FunctionOperand"
>>>                             xmlns:ns2="
>>> https://adwords.google.com/api/adwords/cm/v201409";>
>>>                             <value>
>>>                                 <operator>AND</operator>
>>>                                 <lhsOperand 
>>> xsi:type="ns2:FunctionOperand">
>>>                                     <value>
>>>                                         <operator>EQUALS</operator>
>>>                                         <lhsOperand 
>>> xsi:type="ns2:FeedAttributeOperand">
>>>                                             
>>> <FunctionArgumentOperand.Type>FeedAttributeOperand</FunctionArgumentOperand.Type>
>>>                                             <feedId>23947372</feedId>
>>>                                             
>>> <feedAttributeId>1</feedAttributeId>
>>>                                         </lhsOperand>
>>>                                         <rhsOperand 
>>> xsi:type="ns2:ConstantOperand">
>>>                                             
>>> <FunctionArgumentOperand.Type>ConstantOperand</FunctionArgumentOperand.Type>
>>>                                             <type>STRING</type>
>>>                                             <unit>NONE</unit>
>>>                                             <stringValue>bn</stringValue>
>>>                                         </rhsOperand>
>>>                                     </value>
>>>                                 </lhsOperand>
>>>                                 <rhsOperand 
>>> xsi:type="ns2:FunctionOperand">
>>>                                     <value>
>>>                                         <operator>CONTAINS_ANY</operator>
>>>                                         <lhsOperand 
>>> xsi:type="ns2:FeedAttributeOperand">
>>>                                             
>>> <FunctionArgumentOperand.Type>FeedAttributeOperand</FunctionArgumentOperand.Type>
>>>                                             <feedId>23947372</feedId>
>>>                                             
>>> <feedAttributeId>9</feedAttributeId>
>>>                                         </lhsOperand>
>>>                                         <rhsOperand 
>>> xsi:type="ns2:ConstantOperand">
>>>                                             
>>> <FunctionArgumentOperand.Type>ConstantOperand</FunctionArgumentOperand.Type>
>>>                                             <type>STRING</type>
>>>                                             <unit>NONE</unit>
>>>                                             
>>> <stringValue>ca1</stringValue>
>>>                                         </rhsOperand>
>>>                                         <rhsOperand 
>>> xsi:type="ns2:ConstantOperand">
>>>                                             
>>> <FunctionArgumentOperand.Type>ConstantOperand</FunctionArgumentOperand.Type>
>>>                                             <type>STRING</type>
>>>                                             <unit>NONE</unit>
>>>                                             
>>> <stringValue>ca2</stringValue>
>>>                                         </rhsOperand>
>>>                                         <rhsOperand 
>>> xsi:type="ns2:ConstantOperand">
>>>                                             
>>> <FunctionArgumentOperand.Type>ConstantOperand</FunctionArgumentOperand.Type>
>>>                                             <type>STRING</type>
>>>                                             <unit>NONE</unit>
>>>                                             
>>> <stringValue>ca3</stringValue>
>>>                                         </rhsOperand>
>>>                                     </value>
>>>                                 </rhsOperand>
>>>                             </value>
>>>                         </lhsOperand>
>>>                         <rhsOperand xsi:type="ns3:FunctionOperand"
>>>                             xmlns:ns3="
>>> https://adwords.google.com/api/adwords/cm/v201409";>
>>>                             <value>
>>>                                 <operator>EQUALS</operator>
>>>                                 <lhsOperand 
>>> xsi:type="ns3:RequestContextOperand">
>>>                                     
>>> <contextType>DEVICE_PLATFORM</contextType>
>>>                                 </lhsOperand>
>>>                                 <rhsOperand 
>>> xsi:type="ns3:ConstantOperand">
>>>                                     <type>STRING</type>
>>>                                     <stringValue>Desktop</stringValue>
>>>                                 </rhsOperand>
>>>                             </value>
>>>                         </rhsOperand>
>>>                     </matchingFunction>
>>>                     <placeholderTypes>7</placeholderTypes>
>>>                 </operand>
>>>
>>> response:
>>>
>>>                 <ApiExceptionFault
>>>                     xmlns="
>>> https://adwords.google.com/api/adwords/cm/v201409";>
>>>                     <message>[FunctionError.INVALID_NUMBER_OF_OPERANDS @ 
>>> operations[0].operand.matchingFunction.lhsOperand, 
>>> FunctionError.INVALID_NUMBER_OF_OPERANDS @ 
>>> operations[0].operand.matchingFunction.rhsOperand]</message>
>>>                     
>>> <ApplicationException.Type>ApiException</ApplicationException.Type>
>>>                     <errors xsi:type="FunctionError"
>>>                         xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance";>
>>>                         
>>> <fieldPath>operations[0].operand.matchingFunction.lhsOperand</fieldPath>
>>>                         <trigger/>
>>>                         
>>> <errorString>FunctionError.INVALID_NUMBER_OF_OPERANDS</errorString>
>>>                         <ApiError.Type>FunctionError</ApiError.Type>
>>>                         <reason>INVALID_NUMBER_OF_OPERANDS</reason>
>>>                     </errors>
>>>                     <errors xsi:type="FunctionError"
>>>                         xmlns:xsi="
>>> http://www.w3.org/2001/XMLSchema-instance";>
>>>                         
>>> <fieldPath>operations[0].operand.matchingFunction.rhsOperand</fieldPath>
>>>                         <trigger/>
>>>                         
>>> <errorString>FunctionError.INVALID_NUMBER_OF_OPERANDS</errorString>
>>>                         <ApiError.Type>FunctionError</ApiError.Type>
>>>                         <reason>INVALID_NUMBER_OF_OPERANDS</reason>
>>>                     </errors>
>>>                 </ApiExceptionFault>
>>>
>>> thank you, I am very appreciate your attention to that problem. 
>>>
>>> среда, 25 марта 2015 г., 18:31:08 UTC+2 пользователь Josh Radcliff 
>>> (AdWords API Team) написал:
>>>>
>>>> Hi Sergey,
>>>>
>>>> Sorry I misread your original question. I see now what you're trying to 
>>>> achieve.
>>>>
>>>> I found your requests, and it looks like the issue is that the request 
>>>> is simply malformed. Some of your functions consist of *two* 
>>>> *lhsOperand* attributes and *no* *rhsOperand* attributes.
>>>>
>>>>       <operand>
>>>>         <feedId>23947372</feedId>
>>>>         <campaignId>249285738</campaignId>
>>>>         <matchingFunction>
>>>>           <operator>AND</operator>
>>>>           <*lhsOperand* xmlns:ns2="
>>>> https://adwords.google.com/api/adwords/cm/v201409"; 
>>>> xsi:type="ns2:FunctionOperand">
>>>>             <ns2:value>
>>>>               <ns2:operator>EQUALS</ns2:operator>
>>>> *               <!-- The one below is correct -->*
>>>>               <ns2:lhsOperand xsi:type="ns2:RequestContextOperand">
>>>>                 <ns2:contextType>DEVICE_PLATFORM</ns2:contextType>
>>>>               </ns2:lhsOperand>
>>>>               <ns2:rhsOperand xsi:type="ns2:ConstantOperand">
>>>>                 <ns2:type>STRING</ns2:type>
>>>>                 <ns2:stringValue>Desktop</ns2:stringValue>
>>>>               </ns2:rhsOperand>
>>>>             </ns2:value>
>>>>           </lhsOperand>
>>>>           <*lhsOperand* xmlns:ns3="
>>>> https://adwords.google.com/api/adwords/cm/v201409"; 
>>>> xsi:type="ns3:FunctionOperand">
>>>>             <ns3:value>
>>>>               <ns3:operator>AND</ns3:operator>
>>>>               <ns3:lhsOperand xsi:type="ns3:FunctionOperand">
>>>>                 ...
>>>>               </ns3:lhsOperand>
>>>>               <ns3:lhsOperand xsi:type="ns3:FunctionOperand">
>>>>                 ...
>>>>               </ns3:lhsOperand>
>>>>             </ns3:value>
>>>>           </lhsOperand>
>>>>         </matchingFunction>
>>>>         <placeholderTypes>7</placeholderTypes>
>>>>       </operand>
>>>>
>>>> Please change your request so that for each function you have at least 
>>>> *one* *lhsOperand* and at least *one* *rhsOperand*, as you did in the 
>>>> one I highlighted above in green.
>>>>
>>>> Thanks,
>>>> Josh, AdWords API Team
>>>>
>>>> On Wednesday, March 25, 2015 at 3:02:30 AM UTC-4, Sergey Petrov wrote:
>>>>>
>>>>> Hi Josh
>>>>> Thank you for quick response, but issue not in device field. Maybe I 
>>>>> wan't clear before. 
>>>>> Issue in operands conjuctions, because I can run request device 
>>>>> preferences with easy filter (only business name or only category) but 
>>>>> can't do that with complex one (business name and category). Looks like 
>>>>> we 
>>>>> have some sort of operands limitation which isn't documented. 
>>>>>
>>>>> -- best regards, Sergey 
>>>>>
>>>>> вторник, 24 марта 2015 г., 19:46:02 UTC+2 пользователь Josh Radcliff 
>>>>> (AdWords API Team) написал:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> You can check the last column of the report fields list 
>>>>>> <https://developers.google.com/adwords/api/docs/appendix/reports#campaign>
>>>>>>  to 
>>>>>> see valid filtering values. For the *Device* field, the valid values 
>>>>>> to use in predicates are:
>>>>>>
>>>>>> DESKTOP
>>>>>> HIGH_END_MOBILE
>>>>>> TABLET
>>>>>>
>>>>>> Thanks,
>>>>>> Josh, Adwords API Team
>>>>>>
>>>>>> On Tuesday, March 24, 2015 at 1:38:22 PM UTC-4, Sergey Petrov wrote:
>>>>>>>
>>>>>>> Hi, all 
>>>>>>>
>>>>>>> During run a request to add filter to campaign level which will 
>>>>>>> filter account level location extension with business name filter and 
>>>>>>> category I get INVALID_CONJUNCTION_OPERANDS error. 
>>>>>>>
>>>>>>> Structure of matching function below: 
>>>>>>>
>>>>>>>  AND
>>>>>>>                         
>>>>>>>                             
>>>>>>>                                 AND
>>>>>>>                                 
>>>>>>>                                     
>>>>>>>                                         EQUALS
>>>>>>>                                         
>>>>>>>                                             FeedAttributeOperand
>>>>>>>                                             XXX
>>>>>>>                                             1
>>>>>>>                                                                     
>>>>>>>             
>>>>>>>                                             ConstantOperand
>>>>>>>                                             STRING
>>>>>>>                                             NONE
>>>>>>>                                             bn
>>>>>>>                                         
>>>>>>>                                                                     
>>>>>>>                                                                     
>>>>>>>                                         CONTAINS_ANY
>>>>>>>                                         
>>>>>>>                                             FeedAttributeOperand
>>>>>>>                                             XXX
>>>>>>>                                             9
>>>>>>>                                                                     
>>>>>>>             
>>>>>>>                                             ConstantOperand
>>>>>>>                                             STRING
>>>>>>>                                             NONE
>>>>>>>                                             cat 1
>>>>>>>                                                                     
>>>>>>>                                                                         
>>>>>>>     
>>>>>>>                                                                     
>>>>>>>                                 EQUALS
>>>>>>>                                 
>>>>>>>                                     DEVICE_PLATFORM
>>>>>>>                                 
>>>>>>>                                 
>>>>>>>                                     STRING
>>>>>>>                                     Desktop                         
>>>>>>>      
>>>>>>>                                                                     
>>>>>>>     
>>>>>>>                     7
>>>>>>>
>>>>>>> In case I don't have device platform it goes ok. 
>>>>>>>
>>>>>>> Can't find any limitation rules for device platform usages. 
>>>>>>>
>>>>>>> Thanks. 
>>>>>>>
>>>>>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/226e7680-3e75-454c-9956-3d07060bb55c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to