INVALID_CONJUNCTION_OPERANDS on upload location extension filter with device platform

65 views
Skip to first unread message

Sergey Petrov

unread,
Mar 24, 2015, 1:38:22 PM3/24/15
to adwor...@googlegroups.com
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. 

Josh Radcliff (AdWords API Team)

unread,
Mar 24, 2015, 1:46:02 PM3/24/15
to adwor...@googlegroups.com
Hi,

You can check the last column of the report fields list 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

Sergey Petrov

unread,
Mar 25, 2015, 3:02:30 AM3/25/15
to adwor...@googlegroups.com
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) написал:

Josh Radcliff (AdWords API Team)

unread,
Mar 25, 2015, 12:31:08 PM3/25/15
to adwor...@googlegroups.com
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

Sergey Petrov

unread,
Mar 25, 2015, 2:28:53 PM3/25/15
to adwor...@googlegroups.com
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) написал:

Sergey Petrov

unread,
Mar 26, 2015, 5:51:36 AM3/26/15
to adwor...@googlegroups.com
Hi Josh, 
I am a bit confusing with your first comment because following by documentation
========================================================================================
AND
Operator 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 написал:

Josh Radcliff (AdWords API Team)

unread,
Mar 26, 2015, 8:35:57 AM3/26/15
to adwor...@googlegroups.com
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

Josh Radcliff (AdWords API Team)

unread,
Mar 26, 2015, 8:58:08 AM3/26/15
to adwor...@googlegroups.com
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

Sergey Petrov

unread,
Mar 26, 2015, 10:35:22 AM3/26/15
to adwor...@googlegroups.com
Hi Josh ! 

That is 100% clear understandable and workable ! 
Thank you very much. 

четверг, 26 марта 2015 г., 14:58:08 UTC+2 пользователь Josh Radcliff (AdWords API Team) написал:
Reply all
Reply to author
Forward
0 new messages