You need to sign in to do that
Don't have an account?
Query getRecords
The following line returns an error: 'basicSample_cs.apex.QueryResult' does not contain a definition for 'getRecords'
Account acct = (Account)qr.getRecords(i);
How can I use getRecords?
Thanks,
Andy
// below is actual code
qr = binding.query("SELECT Id, Name, (SELECT id,Account__c FROM ContactAccounts__r) FROM Account WHERE CompanyId__c = " + strCompanyid);
if (qr.size > 0)
{
String[] ids = new String[qr.records.Length];
for (int i = 0; i < ids.Length; i++)
{
ids[i] = qr.records[i].Id;
Account acct = (Account)qr.getRecords(i); // does not compile!!!
}
}
All Answers
I was using an example at
www.salesforce.com/us/developer/docs/api/index_CSH.htm#sforce_api_calls_soql_relationships.htm
This example uses getRecords(). I am now doing what you suggested and everything works.
Thanks,
Andy