Thank you for the excellent summary! Relevant code snippets always make life easier. :)
So far, you're testing whether response.get("getData").getData() [owner.getId()]["setID"] is null. This will return an error if response.get("getData").getData()[owner.getId()] is null. You should be able to use this to your advantage: if response.get("getData").getData()[owner.getId()] returns null, the field has not been created for that person. Please let me know if this works for you. - Jason On May 5, 4:36 pm, Sean <[EMAIL PROTECTED]> wrote: > Hi there, > I had problems figuring out whether the field I want to retrieve by > newFetchPersonAppDataRequest actually existed or not. > What I want to achieve here is that once the application is loaded, it > will go fetch a specific field named "setID "under the Owner by > calling newFetchPersonAppDataRequest. > The returned value of that field thereafter will be used as the > parameter of another function. > If the value of that field is null or that field is not existed at > all, then the application will call a function "OwnerRegister()" for > the owner to set that value. > So far, I can only differentiate the situation when the value is null > but have no clue how to figure out whether that field has been created > by the owner or not. > If that field hasn't been created yet, FireBug will show the following > Error "response.get("getData").getData()[owner.getId()] has no > properties" > I tried to capture this situation by inserting the hadError if > statement "if (response.get("getData").hadError())" > but it still didn't work out. > Does anyone know how to handle this kind of situation? > Thank you in advance. > > Below is the snippet of my application code. > > function getRequest() { > var req = opensocial.newDataRequest(); > req.add(req.newFetchPersonRequest( > opensocial.DataRequest.PersonId.OWNER), > "getOwner"); > req.add(req.newFetchPersonAppDataRequest( > opensocial.DataRequest.PersonId.OWNER, > "setID"), > "getData"); > req.send(getResponse); > > } > > function getResponse(response) { > if (response.get("getOwner").hadError()) > { > document.getElementById("error_response").innerHTML = "Cannot get > Valid User Data.<br>";; > return; > } > var owner = response.get("getOwner").getData(); > > if (response.get("getData").hadError()){ > document.getElementById("error_response").innerHTML = " Errors: > getData. Print out registeration form.<br>"; > ownerRegister(); > return; > } > var testData = response.get("getData").getData()[owner.getId()] > ["setID"]; > if(testData == 'null') { > ownerRegister(); > return; > } > var unescapedTestData = gadgets.util.unescapeString(testData); > var testObject = gadgets.json.parse(unescapedTestData); > XMLWebService(testObject); > > } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---