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
Sourabh KhoslaSourabh Khosla 

SOQL Lookup failing to retrieve values

I have following query that I am trying to run: 

select X__Region__r.Name,  Operating_Unit__c from X__Worker__c where (X__Worker_Status_Current_WA__c = 'Active')

Where X__Region__c is a lookup to the Region table and Name is the value that I trying to retrieve. But I am getting this value returned: 

OrderedDict([(u'attributes', OrderedDict([(u'type', u'X__Region__c), (u'url', u'/services/data/v29.0/sobjects/X__Region__c/aKR0O0000008OIKWA2')])), (u'Name', u'AMER')])

The value that I am hoping to get is in the string above - AMER but the way it is being displayed is not correct as you can see. How do I modify my query?

Raj VakatiRaj Vakati
If you wnat to get only region name try like this
 
String name = [select X__Region__r.Name,  Operating_Unit__c from X__Worker__c where (X__Worker_Status_Current_WA__c = 'Active')].X__Region__r.Name;