View Single Post
  #2 (permalink)  
Old 08-10-2007, 09:15 AM
ncushing ncushing is offline
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 192
Default

What data are you trying to extract? Is it all of the answers for a given response, or answers to a specific question?

To load a specific response, you can follow the following steps, though you'll need to know the response guid.

*Caveat: I haven't built and tested this code...

Code:
//Get a response template
ResponseTemplate rt = ResponseTemplateManager.GetResponseTemplateFromResponseGUID(responseGuid);

//Create a response
Response r = rt.CreateResponse(languageCode); //Language code most likely = en-US

//Load the response
r.Restore(responseGuid);

//Loop and get answers
ReadOnlyCollection responsePages = r.RespronsePages

foreach(ResponsePage page in responsePages) {
  List items = page.Items

  foreach(Item item in items)
  {
    if(item is IAnswerable)
    {
       //Get answer text
       string answer = ((IAnswerable)item).GetAnswer();
  
       //Get item and answer in XML format
       string itemXml = item.ToString("xml");
    }
  }
}
Reply With Quote