1

I'm getting this error on ComplexFilterPart. Does anyone know what's wrong with it?

Error: Incorrect syntax near the keyword 'AND'

If I set RetrieveRequest's Filter to one of the SimpleFilterPart, it works. But setting it to the ComplexFilterPart gives this error.

Here's my code:

        $sfp1 = new ExactTarget_SimpleFilterPart();
        $sfp1->Property = "opt_in";
        $sfp1->Value =  array(1);
        $sfp1->SimpleOperator = ExactTarget_SimpleOperators::equals;

        $sfp2 = new ExactTarget_SimpleFilterPart();
        $sfp2->Property = "email_address";
        $sfp2->Value =  array('example@gmail.com');
        $sfp2->SimpleOperator = ExactTarget_SimpleOperators::equals;

        $cfp = new ExactTarget_ComplexFilterPart();
        $cfp->LeftOperand = $sfp1;
        $cfp->RightOperand = $sfp2;
        $cfp->LogicalOperator = ExactTarget_LogicalOperators::_AND;

        $rr = new ExactTarget_RetrieveRequest();
        $rr->ObjectType = "DataExtensionObject[Example_DE_Key]";
        $rr->Properties = array("email_address", "opt_in");
        $rr->Filter = new SoapVar($cfp, SOAP_ENC_OBJECT, 'ComplexFilterPart', "http://exacttarget.com/wsdl/partnerAPI");
        //$rr->Filter = new SoapVar($sfp1, SOAP_ENC_OBJECT, 'SimpleFilterPart', "http://exacttarget.com/wsdl/partnerAPI");
        //$rr->Filter = new SoapVar($sfp2, SOAP_ENC_OBJECT, 'SimpleFilterPart', "http://exacttarget.com/wsdl/partnerAPI");

        $rrm = new ExactTarget_RetrieveRequestMsg(); 
        $rrm->RetrieveRequest = $rr;

        $results = $client->Retrieve($rrm);
        echo $results->OverallStatus;

Thanks!

1

I think you just have a typo -

$cfp->LogicalOperator = ExactTarget_LogicalOperators::_AND;

Should read

$cfp->LogicalOperator = ExactTarget_LogicalOperators::AND;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.