+ Start a Discussion
danny3107danny3107 

zksforce : get query value

Hi all, 

 

I am new to Objective C and iPhone dev,  so sorry in advance if my question is stupid.

I am trying to get the value of my query.

My Query:

ZKQueryResult *qr = [sforce query:@"select AccountID from Contact where email='xxx@xxx.com'"];

 

I want to display my result:

NSLog(@"query results:%@",[qr records]);

 

And I get :

query results:(

    "Contact (null) fields={\n    AccountId = 001A000000TqfLnIAJ;\n} toNull={(\n)}"

 

Is there a way to get automaticly : 01A000000TqfLnIAJ ?

if not, how can I do? NSRange?

 

Thanks in Advance,


Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell

[qr records] returns an NSArray of ZKSObjects, ZKSObject has getters that take field names, so you'd want to do something like

 

for (ZKSObject *o in [qr records]) {

NSLog(@"%@", [o fieldValue:@"AccountId"]);

}

All Answers

SuperfellSuperfell

[qr records] returns an NSArray of ZKSObjects, ZKSObject has getters that take field names, so you'd want to do something like

 

for (ZKSObject *o in [qr records]) {

NSLog(@"%@", [o fieldValue:@"AccountId"]);

}

This was selected as the best answer
danny3107danny3107

Thanks a lot !