thanks again jason !!!
its clear now   :)

-puneet




On Wed, Mar 26, 2008 at 10:46 PM, Jason <[EMAIL PROTECTED]> wrote:

>
> Just to clarify this response a bit, the object returned by
> viewer.getField(opensocial.Person.Field.CURRENT_LOCATION) is an
> instance of opensocial.Address. So the following is the preferred way
> of retrieving the user's country:
>
> var address =
> viewer.getField(opensocial.Person.Field.CURRENT_LOCATION);
> output(address.getField(opensocial.Address.Field.COUNTRY));
>
> The API reference provides a listing of other address fields you can
> retrieve:
>
>
> http://code.google.com/apis/opensocial/docs/0.7/reference/opensocial.Address.Field.html
>
> Cheers!
> - Jason
>
> On Mar 19, 11:57 am, Jason <[EMAIL PROTECTED]> wrote:
> > Hi puneet. It looks like the object returned by
> > viewer.getField(opensocial.Person.Field.CURRENT_LOCATION) has a
> > fields_ property which contains other properties such as country,
> > locality, and region. So you should be able to output the user's
> > country with this line:
> >
> > output(viewer.getField(opensocial.Person.Field.CURRENT_LOCATION
> ).fields_.country);
> >
> > Cheers!
> > - Jason
> >
> > On Mar 17, 12:13 pm, "puneet jaiswal" <[EMAIL PROTECTED]> wrote:
> >
> > > Jason,
> > > Thanks for reply,
> >
> > > I can see the object fields in firebug, for CURRENT_LOCATION it gives
> the
> > > details
> >
> > > Addresses":[{"City":"Bangalore"
> >
> > >
> ,"Country":"IN","Postal":"","Region":"","Source":"STRUCTURED","Street":"","Type":{"Id":"CUSTOM","Label"
> >
> > > :"currentLocation"}}]
> >
> > > so to retrieve Country or City, how should I use the function ??
> >
> > > output(viewer.getField(opensocial.Person.Field.CURRENT_LOCATION
> ).Country);
> > > ----------> returns undefined value.
> > > however
> > >  output(viewer.getField(opensocial.Person.Field.AGE));
> ---------------->
> > > returns NULL.
> > > still could not figure out how to fetch AGE and fields.
> > > please elaborate it with the CURRENT_LOCATION example.
> >
> > > -puneet.
> >
> > > On Tue, Mar 18, 2008 at 12:23 AM, Jason <[EMAIL PROTECTED]> wrote:
> >
> > > > You can also use the CodeRunner application with FireBug, which I
> > > > discuss in more detail in a separate thread:
> >
> > > >
> http://groups.google.com/group/opensocial-orkut/browse_thread/thread/...
> >
> > > > After installing Coderunner, try pasting this code snippet into the
> > > > main text area:
> >
> > > > function request() {
> > > >  var req = opensocial.newDataRequest();
> >
> > > > req.add(req.newFetchPersonRequest(
> opensocial.DataRequest.PersonId.VIEWER),
> > > > "viewer");
> > > >  req.send(response);
> > > > };
> > > > function response(data) {
> > > >  var viewer = data.get('viewer').getData();
> >
> > > >  output(viewer.getField(opensocial.Person.Field.GENDER));
> > > >  gadgets.window.adjustHeight();
> > > > };
> >
> > > > request();
> >
> > > > [object Object] should be displayed in the output container. Now
> open
> > > > up Firebug or a similar tool -- you can inspect this object to
> > > > determine that the field you're looking for is displayValue. Please
> > > > let me know if this helps.
> >
> > > > Cheers!
> > > > - Jason
> >
> > > > On Mar 17, 2:37 am, "puneet jaiswal" <[EMAIL PROTECTED]> wrote:
> > > > > use object dumper function to get the fields of the object.
> Perhaps some
> > > > > profile fields are not supported by the container so the objects
> return
> > > > > null.
> > > > > please write me back if you can fetch informations like AGE and
> > > > > PRIMARY_EMAIL_ID.
> >
> > > > > -puneet
> >
> > > > > On 3/17/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > > > > > Thank you very much ,
> > > > > > Why I can not find the method (getKey\) in the OpenSocial
> GuideLine??
> >
> > > > > > On Mar 17, 5:16 pm, "puneet jaiswal" <[EMAIL PROTECTED]>
> wrote:
> > > > > > > use it in following way:
> >
> > > > > > > var sex = person.getField(opensocial.Person.Field.GENDER
> ).getKey();
> > > > > > > will return a string male or female.
> >
> > > > > > > you can use object dumper function to dump fields of the
> object.
> >
> > > > > > > <script language="javascript">
> > > > > > > var MAX_DUMP_DEPTH = 10;
> > > > > > > function dumpObj(obj, name, indent, depth) {
> > > > > > > if (depth > MAX_DUMP_DEPTH) {
> > > > > > > return indent + name + ": <Maximum Depth Reached>\n";}
> >
> > > > > > > if (typeof obj == "object") {
> > > > > > > var child = null;
> > > > > > > var output = indent + name + "\n";
> > > > > > > indent += "\t";
> > > > > > > for (var item in obj)
> > > > > > > {
> > > > > > > try {
> > > > > > > child = obj[item];
> >
> > > > > > > } catch (e) {
> >
> > > > > > > child = "<Unable to Evaluate>";}
> >
> > > > > > > if (typeof child == "object") {
> > > > > > > output += dumpObj(child, item, indent, depth + 1);} else {
> >
> > > > > > > output += indent + item + ": " + child + "\n";
> >
> > > > > > > }
> > > > > > > }
> >
> > > > > > > return output;
> >
> > > > > > > } else {
> >
> > > > > > > return obj;
> >
> > > > > > > }
> > > > > > > }
> >
> > > > > > > </script>
> >
> > > > > > > -puneet
> >
> > > > > > > On 3/17/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> > > > > > > > When I have got one person's profile and do this :
> > > > > > > > var sex = person.getField(opensocial.Person.Field.GENDER);
> > > > > > > > How can I output the person's sex ??
> > > > > > > > (opensocial.Person.Field.GENDER is a object )
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to