2

Closed

API change for roboCAML.Query

description

The API should allow another roboCAML.Query to be passed in for grouping/nesting. This would also allow for a previously-generated CAML string to be ANDed or ORed to the new structure.
 
The following example works fine as long as everything can be entered linearly:
roboCAML.Query({
 
webURL: "http://YourURL", //optional
listName: "OneOfEach", //Mandatory
config: [
 
            { filter: "&&", op: ">=", staticName: "Number", value: 3 },
            { filter: "Or", op: "IsNotNull", staticName: "MultiLinesOfText" }, 
            { op: "=", staticName: "Lookup", value: 14, LookupId: true }
      ]
 
});
 
This structure drops each subsequent node further into the nest. But, what if I need to group things a little differently?
 
Suggested change:
roboCAML.Query({
 
webURL: "http://YourURL", //optional
listName: "OneOfEach", //Mandatory
config: [
 
            { filter: "&&", op: ">=", staticName: "Number", value: 3 },
            { filter: "Or", caml: roboCAML.Query({
                 webURL: "http://YourURL", //optional 
                 listName: "OneOfEach", //Mandatory 
                 config: [ { filter: "&&", op: "<=", staticName: "StartDate", value: '2011-12-13' },
                              { op: ">=", staticName: "EndDate", value: '2011-12-13' } ]
            })}, 
            { op: "=", staticName: "Lookup", value: 14, LookupId: true }
      ]
 
});
 
This should render:
<Query>
<Where>
    <And>
        <Geq>
            <FieldRef Name='Number' />
            <Value Type='Number'>3</Value>
        </Geq>
        <Or>
            <And>
                <Leq>
                    <FieldRef Name='StartDate' />
                    <Value Type='DateTime'>2011-12-13</Value>
                </Leq>
                <Geq>
                    <FieldRef Name='EndDate' />
                    <Value Type='DateTime'>2011-12-13</Value>
                </Geq>
            </And>
            <Eq>
                <FieldRef Name='Lookup' LookupId='True' />
                <Value Type='Lookup'>14</Value>
            </Eq>
        </Or>
    </And>
</Where>
</Query>
 
Alternately, if I'd already calculated and stored some CAML (into 'dateCAML' for example), I could do this instead:
 
roboCAML.Query({
 
webURL: "http://YourURL", //optional
listName: "OneOfEach", //Mandatory
config: [
 
            { filter: "&&", op: ">=", staticName: "Number", value: 3 },
            { filter: "Or", caml: dateCAML }, 
            { op: "=", staticName: "Lookup", value: 14, LookupId: true }
      ]
 
});
Closed Jun 18, 2012 at 7:54 PM by iOnline247
These items have been tested and verified to work.

comments

iOnline247 wrote Feb 14, 2012 at 7:24 PM

Going to bang this out for the next version... Thanks JB for your feedback.

wrote Mar 7, 2012 at 8:00 PM

wrote May 31, 2012 at 12:29 PM

wrote Jun 18, 2012 at 7:49 PM

wrote Jun 18, 2012 at 7:54 PM

wrote Feb 13, 2013 at 6:22 PM

wrote May 16, 2013 at 2:43 AM