ReadByQuery()

readByQuery
The readByQuery method reads a list of objects based on an arbitrary query. Use the "*" character to signify you wish to return all fields. To return a field within a nested structure, use dot notation. For example, to return the billing zipcode for a customer, pass BILLTOCONTACT.MAILADDRESS.ZIPCODE. The readByQuery method currently only supports custom objects. To query standard objects, use the getList method defined in version 2.1.

Arguments
object : The name of the object to query fields : A comma separated list of fields to return. Use '*" to specifiy all fields. If no value passed, the method assumes all fields should be returned. query : A standard SQL where clause.  No joins. returnFormat:  One of the values "csv", "json", "xml".  If the user passes no value, will return a fully constructed xml response.

Return
The readByQuery method returns a data element with the records matching the query argument, each record containing the fields passed in the fields argument. The data element may be empty if there are no matching records.

Query the depreciation_schedule custom object
&lt;function controlid="foobar"&gt; &lt;readByQuery&gt; &lt;object&gt;depreciation_schedule&lt;/object&gt; &lt;fields&gt;*&lt;/fields&gt; &lt;query&gt;(depreciation_amount &gt;= 50 and Rasset = 'Thinkpad T61' and Rasset_class = 'Computer Hardware' and posting_date &gt;= '2010-02-01') or Rasset='iPHone'&lt;/query&gt; &lt;returnFormat&gt;csv&lt;/returnFormat&gt; &lt;/readByQuery&gt; &lt;/function&gt;