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
Matt BrineyMatt Briney 

Problem with PHP SDK and expr0 functions

I am running into a problem with the PHP SDK and aggregate functions.  We are trying to do a very simple calculation that counts the number of records by each MailingState.  Our query is as follows:


$query = "SELECT MailingState, count(Contact.Id) from Contact WHERE MailingState != '' GROUP BY MailingState";
$response = $mySforceConnection->query($query);


When I run the PHP code on my local MAMP stack the $response array returns back properly with MailingState and the expr0 count.  However when I run the same code on our remote webserver (Rackspace Cloud Sites), the $response array only shows the MailingState and does not return the aggregate calculation.  


Has anyone run into this problem before?  is there something that we should be looking for in the PHP config?





I'm guessing this is pretty unlikely, but maybe you're using an old version of the API on your webserver?


What version of the API are you running on your different servers?


I think it's set at the end of the WSDL file you're using in the soap:address tag.


Aggregate functions are only available in API v 18 or later.

Matt BrineyMatt Briney

I am using verion 24.0 on both the MAMP stack and remote server.


Same with me! I even posted a separate question and no answer there. Anyway, I just ended up pulling all the data (without using agregate functions) and doing the calculations by myslef over the result set. In my case it was not so much of a big deal, as I was pulling about 7000-8000 records, but how about if you need to make an agregate over 70 000 or 80 000 records ?!


Hope you can find a solution to this, as I couldn't  :]