function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
textualtextual 

running soql in eclipse, not getting count field to show

from here:

 

http://www.salesforce.com/us/developer/docs/api/index_Left.htm#CSHID=sforce_api_calls_soql_select_count.htm|StartTopic=Content%2Fsforce_api_calls_soql_select_count.htm|SkinName=webhelp

 

SELECT Name, Count(Id)
FROM Account
GROUP BY Name
HAVING Count(Id) > 1

 

i can see the field expr0, but it doesnt show the actual count :(

is there another tool to run soql other than eclipse?

Teach_me_howTeach_me_how

try use AggregateResult in execute anonymous see below.

 

aggregateresult[] ag1 = [SELECT Name, Count(Id)mycount FROM Account GROUP BY Name HAVING Count(Id) > 1];

for(aggregateresult ag2:ag1){
    system.debug('name=' + ag2.get('name') + ' ' +  'count=' +  ag2.get('mycount'));
}

 

 

13:10:03.029 (29208000)|EXECUTION_STARTED
13:10:03.029 (29224000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
13:10:03.030 (30652000)|SOQL_EXECUTE_BEGIN|[1]|Aggregations:0|select Name, COUNT(Id) mycount from Account group by Name having COUNT(Id) > 1
13:10:03.200 (200730000)|SOQL_EXECUTE_END|[1]|Rows:1550
13:10:03.204 (204678000)|USER_DEBUG|[4]|DEBUG|name=jeff count=2
13:10:03.204 (204855000)|USER_DEBUG|[4]|DEBUG|name=eugene count=6

textualtextual

cool...but where do i put this code?

do i have to create a page, controller and class to run this?

salesforce expertsalesforce expert

try force.com explorer! Excellent tool to play around!

 

http://wiki.developerforce.com/page/ForceExplorer

 

it would solve all your issues. since eclipse depends with java patches it does not work properly for soql!

 

let me know if it works for you!

 

baskaran