<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Playing with the query object in Read operations on Azure Mobile Services</title><link>http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/21/playing-with-the-query-object-in-read-operations-on-azure-mobile-services.aspx</link><description>As I was writing the last post (about storing per-user data in Azure Mobile Services), I used the where method in the Query object (passed to the read function ) to filter the results only to those for the logged in user. function read(query, user, request</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Playing with the query object in Read operations on Azure Mobile Services</title><link>http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/21/playing-with-the-query-object-in-read-operations-on-azure-mobile-services.aspx#10354449</link><pubDate>Sat, 29 Sep 2012 19:08:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10354449</guid><dc:creator>CarlosFigueira</dc:creator><description>&lt;p&gt;Are you sure you&amp;#39;re not calling &amp;#39;respond&amp;#39; on the *results* object? It needs to be called on the *request* object.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10354449" width="1" height="1"&gt;</description></item><item><title>re: Playing with the query object in Read operations on Azure Mobile Services</title><link>http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/21/playing-with-the-query-object-in-read-operations-on-azure-mobile-services.aspx#10354350</link><pubDate>Sat, 29 Sep 2012 05:22:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10354350</guid><dc:creator>Andrey Filatov</dc:creator><description>&lt;p&gt;first example doesn&amp;#39;t work, raise error:&lt;/p&gt;
&lt;p&gt;Error in &amp;#39;read&amp;#39; script for table &amp;#39;t1&amp;#39;. TypeError: Object [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] has no method &amp;#39;respond&amp;#39;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;at &amp;lt;t1.read.js&amp;gt;:8:29&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;[external code]&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10354350" width="1" height="1"&gt;</description></item><item><title>re: Playing with the query object in Read operations on Azure Mobile Services</title><link>http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/21/playing-with-the-query-object-in-read-operations-on-azure-mobile-services.aspx#10354307</link><pubDate>Fri, 28 Sep 2012 22:23:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10354307</guid><dc:creator>CarlosFigueira</dc:creator><description>&lt;p&gt;Hi Andrey,&lt;/p&gt;
&lt;p&gt;You can always bypass completely the query object and do the querying yourself. In this case, if you have a SQL statement you want to use, you can use the mssql object (&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/windowsazure/jj554212.aspx"&gt;msdn.microsoft.com/.../jj554212.aspx&lt;/a&gt;), something similar to the code below:&lt;/p&gt;
&lt;p&gt;function read(query, user, request) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;mssql.query(&amp;#39;select * from t2 order by name&amp;#39;, [], {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;success: function(results) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;request.respond(statusCodes.OK, results);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;});&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;Another alternative is to use the tables object (&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/windowsazure/jj614364.aspx"&gt;msdn.microsoft.com/.../jj614364.aspx&lt;/a&gt;) to get a reference to the table t2, and read it from there:&lt;/p&gt;
&lt;p&gt;function read(query, user, request) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;var t2 = tables.getTable(&amp;#39;t2&amp;#39;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;t2.orderBy(&amp;#39;Name&amp;#39;).read({&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;success: function(results) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;request.respond(statusCodes.OK, results);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;});&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10354307" width="1" height="1"&gt;</description></item><item><title>re: Playing with the query object in Read operations on Azure Mobile Services</title><link>http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/21/playing-with-the-query-object-in-read-operations-on-azure-mobile-services.aspx#10354304</link><pubDate>Fri, 28 Sep 2012 22:10:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10354304</guid><dc:creator>Andrey Filatov</dc:creator><description>&lt;p&gt;thanks for the Article! Can you give one example how can be made? &lt;/p&gt;
&lt;p&gt;Client read from one table (t1), there is one script on READ. Idea of this script not put data not from this table (t1), put from another table (t2) by SQL query (select * from t2 order by ....)?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10354304" width="1" height="1"&gt;</description></item><item><title>re: Playing with the query object in Read operations on Azure Mobile Services</title><link>http://blogs.msdn.com/b/carlosfigueira/archive/2012/09/21/playing-with-the-query-object-in-read-operations-on-azure-mobile-services.aspx#10352042</link><pubDate>Fri, 21 Sep 2012 14:15:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10352042</guid><dc:creator>Srikanth Kammadanam</dc:creator><description>&lt;p&gt;Good Article. Kepp up the good work.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10352042" width="1" height="1"&gt;</description></item></channel></rss>