B.3 Performing an Advanced Search Using a JSON-formatted Query

You can use the QUERY parameter to perform an advanced search using JSON. The JSON syntax rules are the same as those for the basic search. The only difference is that an advanced search typically defines multiple condition groups and condition rows. The JavaScript variable shown below illustrates how the QUERY parameter might be constructed for a search that uses several condition groups and condition rows:

var search2 = 'QUERY={"k":"Complicated Search All OK","mxPg":"10","mxRes":"0","ptr":"1","grp":[{"map":{"row":[{"map":{"rowRop":"equals","rowVal":"cn=bg1,ou=groups,ou=idmsample,o=novell","rowAttr":"group"}},{"map":{"rowRop":"contains","rowVal":"0","rowAttr":"FirstName"}}],"rowLop":"and"}},{"map":{"row":[{"map":{"rowRop":"not-present","rowVal":"","rowAttr":"TelephoneNumber"}},{"map":{"rowRop":"equals","rowVal":"cn=ablake,ou=users,ou=idmsample,o=novell","rowAttr":"directReports"}},{"map":{"rowRop":"equals","rowVal":"cn=cnano,ou=users,ou=idmsample,o=novell","rowAttr":"manager"}}],"rowLop":"and"}},{"map":{"row":[{"map":{"rowRop":"not-present","rowVal":"","rowAttr":"TelephoneNumber"}},{"map":{"rowRop":"equals","rowVal":"cn=ablake,ou=users,ou=idmsample,o=novell","rowAttr":"directReports"}},{"map":{"rowRop":"equals","rowVal":"cn=cnano,ou=users,ou=idmsample,o=novell","rowAttr":"manager"}}],"rowLop":"and"}}],"orderBy":"LastName","entDef":"user","sScope":"","sRoot":"","grpLop":"or","selAttr":["FirstName","Title","Email","TelephoneNumber"]}';

For details on each of the JSON settings, see Section B.1.2, Using a JSON-formatted String to Represent a Query.