Re: How to query MObjects that values of a specified field IN a set just like 'IN' operator in SQL?

Anonymous
Not applicable

How to query MObjects that values of a specified field IN a set just like 'IN' operator in SQL?

Hi all,

I'm trying to query MObjects that values of a specified field IN a set just like 'IN' operator in SQL.
e.g. I want to get MObjects that the values of field 'ID' is contained in the set (1, 3, 5).
Any suggestions?

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

Re: How to query MObjects that values of a specified field IN a set just like 'IN' operator in SQL?

I don't believe that is possible with the current getMObject API.  I think the next best thing is to request the list of IDs you are interested in using the greater than option and iterating until you've reached the upper limit.  See sample request below.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ns2:paramsGetMObjects xmlns:ns2="http://www.marketo.com/mktows/">

    <type>Opportunity</type>

    <mObjCriteriaList>

        <mObjCriteria>

            <attrName>Id</attrName>

            <comparison>GT</comparison>

            <attrValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">59</attrValue>

        </mObjCriteria>

    </mObjCriteriaList>

</ns2:paramsGetMObjects>

Anonymous
Not applicable

Re: How to query MObjects that values of a specified field IN a set just like 'IN' operator in SQL?

Hi Travis,

I'm trying to make request following your suggestion. Thank you very much.
But I met another problem.
When getting objects whose IDs are between 3 and 5, I pass "Id" "GE" "3" and "Id" "LE" "5". I know that mObjCriteriasin the list would be AND together, and when I use different attrNames, it works well. At this time, "Id <= 5" works but "Id >= 3" not. When I change their order, "Id >= 3" works but "Id <= 5" not. It seems that only the last one of items using the same attrName could work. Is that right? Please let me know if I'm doing anything wrong.
How could I get MObjects that Id between two values?

Thanks & Regards,
Biao

Anonymous
Not applicable

Re: How to query MObjects that values of a specified field IN a set just like 'IN' operator in SQL?

We too face the similar problem in case of mutlipe conditions on the single columns.

Can someone from Marketo reply with the correct behavior of Marketo in this case?


Anonymous
Not applicable

Re: How to query MObjects that values of a specified field IN a set just like 'IN' operator in SQL?

We are having same problem, Can someone from marketo have a look in this issue please.