Thanks Jason. It is working fine :)

On Mar 1, 5:23 am, Jason <[EMAIL PROTECTED]> wrote:
> Hi Rush. Your 'mydata' object is probably null; try making the
> following change to your hasFlag routine and let me know if the issue
> persists.
>
> function hasFlag(data)
> {
>   if(data==null)
>   {
>     return false;
>   }
>   var mydata = data[me.getId()];
>   if (mydata && mydata["flag"]=="true")
>     return true;
>
>   return false;
>
> };
>
> On Feb 29, 3:58 am, rush <[EMAIL PROTECTED]> wrote:
>
>
>
> > But not working for me. I have tried this xml also. First it is
> > showing alert as owner's display name and then hello orkut. But there
> > is an error also "mydata has no properties" on error console. :(
>
> > On Feb 29, 4:28 pm, pradeep <[EMAIL PROTECTED]> wrote:
>
> > > The exact same code is working properly for me.
>
> > >http://hosting.gmodules.com/ig/gadgets/file/101774835574226898257/exa...
>
> > > On Feb 29, 2:49 pm, rush <[EMAIL PROTECTED]> wrote:
>
> > > > Still not working :(
> > > > I m using following code
>
> > > >     gadgets.util.registerOnLoadHandler(init);
>
> > > >                 function init()
> > > >                 {
> > > >                         loadFriends();
> > > >                 }
>
> > > >                 function loadFriends()
> > > >                 {
> > > >                         var req = opensocial.newDataRequest();
> > > >                         req.add(req.newFetchPersonRequest('OWNER'), 
> > > > 'viewer');
> > > >                         req.send(onLoadFriends);
> > > >                 }
> > > >                 var me=null;
> > > >                 function onLoadFriends(data)
> > > >                 {
> > > >                   me = data.get('viewer').getData();
> > > >                         alert(me.getDisplayName());
> > > >                         var req1 = opensocial.newDataRequest();
> > > >                         var fields = [ "flag"];
>
> > > > req1.add(req1.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.­­OWNER,fields),'data');
>
> > > >                         req1.send(onLoadAppData);
>
> > > >                 }
> > > >                 function onLoadAppData(data)
> > > >                 {
> > > >                         var mydata = data.get('data').getData();
> > > >                         if(!hasFlag(mydata))
> > > >                         {
> > > >                                 alert("not flagged");
> > > >                                         var req2 = 
> > > > opensocial.newDataRequest();
> > > >                                         var data1 = "true";
> > > >                                         
> > > > req2.add(req2.newUpdatePersonAppDataRequest("VIEWER", "flag",
> > > > data1));
> > > >                                         
> > > > req2.send(handlePopulateMyAppData);
>
> > > >                         }
> > > >                         else
> > > >                         {
> > > >                                 alert("flagged");
> > > >                         }
>
> > > >                 }
> > > >                 function handlePopulateMyAppData(data)
> > > >                 {
> > > >                         alert("data updated");
> > > >                 };
>
> > > >                         function hasFlag(data)
> > > >                                 {
>
> > > >                                         if(data==null)
> > > >                                         {
> > > >                                                 return false;
> > > >                                         }
> > > >                                         var mydata = data[me.getId()];
> > > >                                         if(mydata["flag"]=="true")
> > > >                                                 return true;
> > > >                                         return false;
> > > >                                 };
>
> > > > showing error "mydata has no properties" :(
>
> > > > On Feb 29, 11:57 am, pradeep <[EMAIL PROTECTED]> wrote:
>
> > > > > Use three different requests for app data update , (person-people
> > > > > requests) and app data fetch.
>
> > > > > I am using this method and the problem got solved.
>
> > > > > On Feb 29, 10:46 am, rush <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi Pradeep,
>
> > > > > > Thanks for reply. I have made changes as u said but still not 
> > > > > > working
> > > > > > and same error. Actually I want data for viewer and it was working
> > > > > > fine in the giving gifts example as well as in my application before
> > > > > > two days. But when I tried it yesterday it was not working.
>
> > > > > > var opt_params = { };
> > > > > > opt_params[opensocial.DataRequest.PeopleRequestFields.FILTER]=[opensocial.D­­­ataRequest.FilterType.HAS_APP];
>
> > > > > > var req = opensocial.newDataRequest();
> > > > > > req.add(req.newUpdatePersonAppDataRequest(opensocial.DataRequest.PersonId.O­­­WNER,
> > > > > > 'gifts', json));
> > > > > > req.add(req.newFetchPersonRequest('OWNER'), 'viewer');
> > > > > > req.add(req.newFetchPeopleRequest('OWNER_FRIENDS'), 
> > > > > > 'viewerFriends');
> > > > > > req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OW­­­NER,'gifts'),
> > > > > > 'data');
> > > > > > req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.Group.OWNER­­­_FRIENDS,'gifts',opt_params),
> > > > > > 'viewerFriendData');
> > > > > > req.send(onLoadFriends);
>
> > > > > > Regards
> > > > > > Rush
>
> > > > > > On Feb 29, 10:05 am, pradeep <[EMAIL PROTECTED]> wrote:
>
> > > > > > > Hi Rush,
>
> > > > > > > Change the request logic for getting app data as follows
>
> > > > > > > var req = opensocial.newDataRequest();
> > > > > > > var opt_params = { };
> > > > > > > opt_params[opensocial.DataRequest.PeopleRequestFields.FILTER]
> > > > > > > =[opensocial.DataRequest.FilterType.HAS_APP];
> > > > > > > req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.PersonId.OW­­­­NER,
> > > > > > > 'gifts'), 'data');
> > > > > > > req.add(req.newFetchPersonAppDataRequest(opensocial.DataRequest.Group.OWNER­­­­_FRIENDS,
> > > > > > > 'gifts',opt_params), 'viewerFriendData');
> > > > > > > req.send(onLoadAppData);
>
> > > > > > > Use OWNER_FRIENDS instead of VIEWER_FRIENDS.
>
> > > > > > > On Feb 29, 9:48 am, rush <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Is there anybody who can help me? It is not working yet.
>
> > > > > > > > Thanks
> > > > > > > > Rush
>
> > > > > > > > On Feb 28, 1:55 pm, rush <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > > Hi all,
>
> > > > > > > > > I got the error while executing the sample code of giving 
> > > > > > > > > gifts
> > > > > > > > > available in tutorial.
> > > > > > > > >      Error: data[viewer.getId()] has no properties
> > > > > > > > >     Source 
> > > > > > > > > File:http://opensocial-resources.googlecode.com/svn/samples/tutorial/tags/api
> > > > > > > > > -0.7/gifts_4_showing_received.js Line: 36
>
> > > > > > > > > The same error is also in my application.
> > > > > > > > > What is the problem?
>
> > > > > > > > > Thanks
> > > > > > > > > Rush- Hide quoted text -
>
> > > > > > > - Show quoted text -- Hide quoted text -
>
> > > > > - Show quoted text -- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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