Re: What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

Anonymous
Not applicable

What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

Hi all,

When creating 2 or more items to ParamsGetMObjects.mObjCriteriaList, what is the logical relation between the criteria? Someone told me that 'When you supply multiple Ids, we OR them.  It is an AND when other criteria are supplied' before.

But when my list contains 2 items
with the same field name, it doesn't work. E.G. 'Id > 3' and 'Id < 8'.
I want to get the records with Id 4, 5, 6,and 7, but the results also contain 1, 2, and 3. When I set 'Id > 3' after 'Id < 8' in the list, the results contain all records 'Id > 3', and many have a Id greater than 8.

When my filter is 'Id = 3 and Id = 8', in the logic above it means two records would be returned with Id 3 and 8, and in SQL Server logic it means nothing. But when I call API getMObjects(), I get record only Id = 8.

Is there anything I miss?

Best Regards,
Biao
Tags (1)
6 REPLIES 6
Anonymous
Not applicable

Re: What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

This documentation might help you locate the right answer:

http://developers.marketo.com/documentation/soap/getmobjects/

What it appears you are attempting to do is create an if->then logic step with compound statements.  This is not how this appears to be handled with API calls. 

There are not <,>,== operators available, you will need to set multiple criteria.  I.E. criteria1 and critera2.

I am not sure what language you are using, but look at the example code provided and I hope it clears this up for you.  You need to set multiple criteria variables, and then set those criteria into an array. 

Hope that helps!

Thanks,
James
Anonymous
Not applicable

Re: What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

Hi James,

I use >,<,= just for example.
My parameter in my request is as follow:

  • <mObjCriteriaList>
  •         <mObjCriteria>
  •           <attrName>Id</attrName>
  •           <comparison>GT</comparison>
  •           <attrValue>3</attrValue>
  •         </mObjCriteria>
  •         <mObjCriteria>
  •           <attrName>Id</attrName>
  •           <comparison>LT</comparison>
  •           <attrValue>8</attrValue>
  •         </mObjCriteria>
  •       </mObjCriteriaList>
But Ids of some results are out of the range (3, 8).

Thanks,
Biao
Kenny_Elkington
Marketo Employee

Re: What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

Hey Biao,

Could you provide the full text of the Request and Response for your query?  Feel free to sanitize any sensitive data.
Anonymous
Not applicable

Re: What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

Hi Kenny,

I have 4 records in OpportunityPersonRole.
when I try to get records that Id is 2 and 3, I send a request that Id is greater than 1 and less than 4 as following:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Header>
        <AuthenticationHeader xmlns="http://www.marketo.com/mktows/">
            <mktowsUserId xmlns="">latticeenginessandbox1_9026948050BD016F376AE6</mktowsUserId>
            <requestSignature xmlns="">7bd4bbc7b5bc16e86943c29d1d5ccf6540c09b12</requestSignature>
            <requestTimestamp xmlns="">2014-01-26T02:53:21Z</requestTimestamp>
        </AuthenticationHeader>
    </soap:Header>
    <soap:Body>
        <paramsGetMObjects xmlns="http://www.marketo.com/mktows/">
            <type xmlns="">OpportunityPersonRole</type>
            <mObjCriteriaList xmlns="">
                <mObjCriteria>
                    <attrName>Id</attrName>
                    <comparison>GT</comparison>
                    <attrValue>1</attrValue>
                </mObjCriteria>
                <mObjCriteria>
                    <attrName>Id</attrName>
                    <comparison>LT</comparison>
                    <attrValue>4</attrValue>
                </mObjCriteria>
            </mObjCriteriaList>
        </paramsGetMObjects>
    </soap:Body>
</soap:Envelope>

But the response contains 3 records, the Ids are 1, 2, and 3, which means that the first mObjCriteria doesn't work but only the last one works. The response text is as following:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.marketo.com/mktows/">
    <SOAP-ENV:Body>
        <ns1:successGetMObjects>
            <result>
                <returnCount>3</returnCount>
                <hasMore>false</hasMore>
                <newStreamPosition>8UJZetaMb1V6uUZl+L7DcPP2jG+RKsLqq65yGfLq8d03zQolXbaXYgPMmtpFGYA7ZKvEUlNKC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03JVm3L+9x64h1sUGSg+qvBxffeHRclNR8DnK18MAmLelulLqZQGeGzo6GCAvsxZEXOwVBJmIryW6ZxmUXucag7EYihJ333+aQ8elaxqwPAYK6V+8ZPkAHjzq0VxjXjY4UCWL3VZrGrsdZ2nfgKl5eeAygv09pDpUFco2BuNw+gUIEMnMJVQOFOCfEW9CNhfRBwx+PRyQf6DEjY9lMKb3LvYmTEtY9S4ZHOwgdBujzVF4CTj+u0+wHly1R51ESH9b1ujbTYdZ0HqaQ4tOHJFx5D7UnDgEN5/TdBEXqhAW1XJBrYFT8sWSdW2KsFX3bkhFbgzW8zo8xTGUAV3cRsmRz5Irb6d9S0+bF9d0fekUZfZy6OHxJL9BXkruCR/hDloqgxWBKmD6B7lXito1LmvG6EzfUzSAuiaeyaiFhbp+MRLKr/apqE9U1hG437lGm5KtDI7iA+Mph4ZxT+8/+3p2EydKubftV4cSiebgxR0IEM/5S0zcHDuLZ+JqMFnwahIqYUkEsv/1N1ZpPXd7NkDCScNdLyUgILiqRofpMnGBMovmKp/qFLKxGgnpeNeXP2HSx247U3jvD52cAT9Ub04C6ZH6B2xTKX0YCWIj9u5PT85V8LUmzsQtPpgBF8e7vNBMvih98NNAhQhVKqIMLicHxqfwP0xq6r7DfDc0bpY4=</newStreamPosition>
                <mObjectList>
                    <mObject>
                        <type>OpportunityPersonRole</type>
                        <id>1</id>
                        <attribList>
                            <attrib>
                                <name>ExternalCreatedDate</name>
                                <value>2014-11-15T00:00:00-06:00</value>
                            </attrib>
                            <attrib>
                                <name>IsPrimary</name>
                                <value>1</value>
                            </attrib>
                            <attrib>
                                <name>OpportunityId</name>
                                <value>1</value>
                            </attrib>
                            <attrib>
                                <name>PersonId</name>
                                <value>1</value>
                            </attrib>
                            <attrib>
                                <name>Role</name>
                                <value>10</value>
                            </attrib>
                        </attribList>
                    </mObject>
                    <mObject>
                        <type>OpportunityPersonRole</type>
                        <id>2</id>
                        <attribList>
                            <attrib>
                                <name>ExternalCreatedDate</name>
                                <value>2013-08-15T00:00:00-05:00</value>
                            </attrib>
                            <attrib>
                                <name>IsPrimary</name>
                                <value>1</value>
                            </attrib>
                            <attrib>
                                <name>OpportunityId</name>
                                <value>1</value>
                            </attrib>
                            <attrib>
                                <name>PersonId</name>
                                <value>1</value>
                            </attrib>
                            <attrib>
                                <name>Role</name>
                                <value>1</value>
                            </attrib>
                         </attribList>
                    </mObject>
                    <mObject>
                        <type>OpportunityPersonRole</type>
                        <id>3</id>
                        <attribList>
                            <attrib>
                                <name>OpportunityId</name>
                                <value>5</value>
                            </attrib>
                            <attrib>
                                <name>PersonId</name>
                                <value>5</value>
                            </attrib>
                            <attrib>
                                <name>Role</name>
                                <value>5</value>
                            </attrib>
                        </attribList>
                    </mObject>
                </mObjectList>
            </result>
         </ns1:successGetMObjects>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Thanks,
Biao
Anonymous
Not applicable

Re: What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

Hi Kenny,

In last example, I tried to exchange the order of the two mObjCriteria. The (Id, LT, 4) is at the front of (Id, GT, 1) as following:

            <mObjCriteriaList xmlns="">
                <mObjCriteria>
                    <attrName>Id</attrName>
                    <comparison>LT</comparison>
                    <attrValue>4</attrValue>

                </mObjCriteria>
                <mObjCriteria>
                    <attrName>Id</attrName>
                    <comparison>GT</comparison>
                    <attrValue>1</attrValue>

                </mObjCriteria>
            </mObjCriteriaList>


Then I also got 3 records, but the Ids are 2, 3, and 4. It seems that only the last mObjCriteria works.
But the correct result should only contains records which Ids are 2 and 3 (be GT 1 and LT 4).

Any suggestions?

Thank you very much,
Biao

Anonymous
Not applicable

Re: What is the logic between items of ParamsGetMObjects.mObjCriteriaList?

Hi All,

We too face the similar problem. 

Can someone from Marketo reply with the correct behavior of Marketo in case of mObjCriteria.