+ Start a Discussion
Krishna Prasad K PKrishna Prasad K P 

"select count() ..." returns nothing!!

I recently started using the AJAX  'Explorer' for querying the SObjects.
But I do not get the result for "SELECT count() FROM <SObject>" statement !!.
I tried it for almost all my SObjects. But the output window shows nothing !!
 
Please provide  me a solution,
Thanks in advance
Krishna
RickyGRickyG
Krishna -

Not sure what your problem might be, but the syntax works fine for me with Apex Explorer 8.0.

SELECT COUNT() FROM ARTIST__C

Hope this helps.

Krishna Prasad K PKrishna Prasad K P
Hi Ricky,
I dont get results as tried with AJAX function tandard SObjects
cheenathcheenath
I think the Explorer is not displaying the size. You can run the same query in
debug shell (click the 'shell' icon in Ajax Tools), eg:

sforce.connection.query("SELECT count() FROM Account");

And this should display the count.

HTHs,




Krishna Prasad K PKrishna Prasad K P
My observations on this issue
 
*    Any browser shows the result for the query:"  SELECT count() FROM <SObject> "  in 'Explorer' tool in AJAX Toolkit. ? 
*    Ajax function which passes query to the server is  --->  sforce.connection.query("<query>").
*    Result of the Ajax function "sforce.connection.query"  is a structure in the form
        {
            done:'true',     //query - success or failure?
            queryLocator:null, 
            records:{  type:'<SObject>',    Id:<id>,   field1:value1,field2:value2,.....   },
                        {  type:'<SObject>',    Id:<id>,   field1:value1,field2:value2,.....   },
                                        //each record is a sub structure 
            size:'<no of records>',                       // size is total number of records
        }
*    QueryResultIterator(), and getArray() are the functions to where we pass the result structure to parse it and seperate each sub item.
*    But 'select count()... ' result structure is a bit different from other query results. The result structure's 'records' item contains null but 'size' contains the actual result(means the count() value)...
*    But the 'Explorer tool' source code ONLY parses 'records' and it shows in table format...
*    Unfortunately 'select count() ...' result structure contains null records so we cannot see the results..!!
*    Internet Explorer does not even support the Shell tool..
 
Am I..?  ;-)
 
Thank you,
Krishna

Message Edited by Krishnaprasad on 11-16-2007 03:02 AM