In my last blog post, CFMobile Example – Accessing remote data from mobile application, I explained how to access data returned by a remote CFC. The CFC queried a database table, but returned array of struct/object to cfclient.
In a comment on that blog post, Tayyab posted a problem, where in he returned a query object from CFC and tried to access it from cfclient. I thought instead of posting the answer as a comment, it deserved a separate post.
This is what he asked -
These are the 2 most simplest coldfusion files. One is a cfc and the other a CFM but when I wrap the cfm into <cfscript> tag I get a blank page.
I think he meant wrapping CFML code in <cfclient>. The code in two files he posted were -
If you just wrapped code in listCustomers.cfm in <cfclient> block then nothing would be displayed.
So you need to access query rows and columns differently for CF query returned from the server. I have created a similar example as above - not using Customer database, but using cfbookclub data source that is shipped with Splendor. I have two files now - book.cfc and listBooks.cfm.
We could probably simplify it a bit, but as of now this is how you can access server side CF query data in cfclient. If you are going to run the above example, make sure that cfbookclub data source is created on the server.