You need to sign in to do that
Don't have an account?
Viraj M
But when i write max date column after Parent__c then query only returns Parent__c(parentid) - Can any one tell why this weird behaivor happens
SOQL Query issue - Not displaying Max Date when max column added last in query
Select MAX(Date__c),Parent__c parentid From Child__c group by Parent__cIf i write max Date column first before Parent__C then query returns proper output with Date and Parent__C (parentid)
But when i write max date column after Parent__c then query only returns Parent__c(parentid) - Can any one tell why this weird behaivor happens
Select Parent__c parendId,MAX(Date__c) From Child__c group by Parent__c
It is clearly a bug of the workbench. Easy to reproduce with Account and ParentId.
The REST responses are like below with expr0 and are always correct. You can test these requests from Utilities > REST Explorer
But the workbench uses PHP and SOAP : you can read the entire source code of the workbench here:
https://code.google.com/archive/p/forceworkbench/downloads
https://developer.salesforce.com/blogs/engineering/2009/11/php-client-for-forcecom-bulk-api.html
In fact, the workbench considers all the aggregated fields as "Unkown_fields".
If the "Unkown_fields" are the last fields of the response, they are just ... ignored (no array push).
Otherwise, you can have the results of these Unkown_fields because the following fields are pushed.
SOQL: SELECT Parentid parent , MAX(createddate) From Account group by Parentid
Rest request OK: /services/data/v39.0/query/?q=SELECT+Parentid+parent,MAX(createddate)+From+Account+group+by+Parentid
{
"totalSize" : 3,
"done" : true,
"records" : [ {
"attributes" : {
"type" : "AggregateResult"
},
"parent" : null,
"expr0" : "2016-12-24T23:13:47.000+0000"
}, {
"attributes" : {
"type" : "AggregateResult"
},
"parent" : "0010Y000009SvCyQAK",
"expr0" : "2016-10-28T20:19:08.000+0000"
} ]
}
SOQL: SELECT MAX(createddate), Parentid parent From Account group by Parentid
Rest request OK: /services/data/v39.0/query/?q=SELECT+MAX(createddate),Parentid+parent+From+Account+group+by+Parentid
{
"totalSize" : 3,
"done" : true,
"records" : [ {
"attributes" : {
"type" : "AggregateResult"
},
"expr0" : "2016-12-24T23:13:47.000+0000",
"parent" : null
}, {
"attributes" : {
"type" : "AggregateResult"
},
"expr0" : "2016-10-28T20:19:08.000+0000",
"parent" : "0010Y000009SvCyQAK"
}]
}
But the PHP code of the workbench (KO) is like that and you find easily : Unknown_Field__
We can read the entire source code of the workbench (php) and the dataloader (java).
Best regards
Alain
from account
.. works owith workbench because there is only one result (no group by) and there is the push.
A PHP specialist could support the hypothesis. I found the code but I am not sure of the reason for the last aggregated fields of the response without debugging finely the PHP code.
Regards