Arrays in JSON are accessed differently. try [0] etc. On Mon, Mar 23, 2009 at 7:01 PM, neopnet <neop...@gmail.com> wrote:
> > Thanks Apurv and Vijaya for your help. > > pls give me one more help. I made a small change in my code. in the > AppField1 i want to store array. so I canged code > ------------------------------------------------------------- > var artists = new Array(); > > artists.push('AKON'); > artists.push('Brtiney Spears'); > artists.push('KJ Yesudas'); > > req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField1", > artists)); > --------------------------------------------------------------------- > > and to disply > > <script xmlns:os="http://ns.opensocial.org/2008/markup" > type="text/os- > data"> > <os:PersonAppDataRequest key="MyData" method="appdata.get" > userId="@owner" appId="@app" /> > <os:OwnerRequest key="owner"/> > </script> > > <script type="text/os-template"> > <div>${MyData}</div><br> > ${MyData[owner.id]['AppField1']['0']}<br> > ${MyData[owner.id]['AppField1']['1']}<br> > ${MyData[owner.id]['AppField1']['2']}<br> > </script> > --------------------------------------------------------------------- > > It seems the data is storing correctly but at the time of displying > it's not printing correctly. > > Kindly help. > > {"14243035565542385134":{"AppField1":"[\"AKON\",\"Brtiney Spears\", > \"KJ Yesudas\"]","AppField2":"Female","AppField3":"1237813540120"}} > > this give me req.add(req.newFetchPersonAppDataRequest("VIEWER", > fields), "viewer_data"); > out put - My AppField1 data is: ["AKON","Brtiney Spears","KJ Yesudas"] > > not sure how it will be in template. > > ---------------------------------------------------------------------- > > in addition to above i have few question. > > how i can use a foor lop to disply all elements in AppField1 > > how i can check no of elements in AppField1 and pick a random element. > > Thanks! > On Mar 23, 3:35 pm, Apurv Gupta <apurv.gu...@gmail.com> wrote: > > Correction: > > ${MyData[owner.id]['AppField1']} > > > > since AppField1 needs to be a string. > > > > On Mon, Mar 23, 2009 at 4:03 PM, Vijaya <api.vij...@google.com> wrote: > > > > > Add another datapipelining request: > > > <os:OwnerRequest key="owner"/> > > > > > Then you can use the following: > > > <div>${MyData[owner.id][AppField1]}</div> > > > --~--~---------~--~----~------------~-------~--~----~ 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 opensocial-orkut+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/opensocial-orkut?hl=en -~----------~----~----~----~------~----~------~--~---