Go Back   CHECKBOX® Online Community > Checkbox® > CHECKBOX® Developer Kit

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-08-2007, 01:58 AM
Junior Member
 
Join Date: Aug 2007
Posts: 4
Default Response Extraction

I'm looking for possible solutions to extract the responses.
1. Use Developer API - I don't see enough documentation to use the IAnswerData interface yet. Are there other API options I should look at?
2. Extract XML in an automated way and feed it to the alternate repository. Is there an automated way provided by Checkbox (a hook?)
3. Put an after trigger on the ckbx_Response table that selects the ckbx_ResponseAnswers into the alternate repository when the ckbx_Response.IsComplete becomes true.
4. Live with the split data store and make calls directly against the Checkbox database ckbx_Response & ckbx_ResponseAnswer tables.

Can anyone help flush out the viability of these options or offer their idea?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 08-10-2007, 09:15 AM
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 187
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<ResponsePage> responsePages = r.RespronsePages

foreach(ResponsePage page in responsePages) {
  List<Item> 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
  #3 (permalink)  
Old 08-13-2007, 04:32 PM
Junior Member
 
Join Date: Aug 2007
Posts: 4
Default All Responses for a ResponseTemplate

Thanks. The code snipet was helpful, but I would like all responses.
I see that the Response table has all the respond Guids, but I don't see
a method exposed in ResponseTemplateManager to fish them out. I don't
see a sproc to do this either.

I just need a Guid[] and I can go from there.

I'll post working code once this problem is solved. Thanks.
Reply With Quote
  #4 (permalink)  
Old 08-13-2007, 06:09 PM
Junior Member
 
Join Date: Aug 2007
Posts: 4
Default Stored Procedure

Actually, I do see a stored procedure, ckbx_Response_GetForRT, but it is out of sync with the ckbx_Response table. In particular, it selects a UserID in the sproc when that field is not in the table.

FYI, I'm dealing with version 4.2.0 according to ckbx_ProductInfo
Reply With Quote
  #5 (permalink)  
Old 08-13-2007, 06:16 PM
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 187
Default

To list responses for a given survey, you can call the static ResponseManager.GetResponseList(...) method. Visual Studio is updating itself, so I don't have access to the code just yet, but intellisense should give you the method signature.

The method takes quite a few arguments including the database ID of the survey to list responses for. To list all responses, pass negative numbers for the results per page and page number parameters, and null or empty strings for the searching and sorting parameters.
Reply With Quote
  #6 (permalink)  
Old 02-05-2008, 06:46 PM
Junior Member
 
Join Date: Feb 2008
Posts: 5
Default Assemblies

What assembly needs to bew referenced to use the above code?
Reply With Quote
  #7 (permalink)  
Old 02-05-2008, 07:39 PM
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 187
Default

The ResponseManager class is in the Checkbox.Forms namespace which is contained in the Checkbox assembly.
Reply With Quote
  #8 (permalink)  
Old 02-05-2008, 08:35 PM
Junior Member
 
Join Date: Feb 2008
Posts: 5
Default

Thanks. Is this kind of thing an accepted way of intereacting with the tool. If so is there documentation for it? How does it differ from the Web Services?
Reply With Quote
  #9 (permalink)  
Old 02-06-2008, 01:38 PM
Administrator
 
Join Date: Mar 2007
Location: Prezza Technologies
Posts: 187
Default

This is indeed an accepted way of interacting with the tool. Documentation and more support channels are available to customers who have purchased the Developer Kit. To obtain the documentation or the developer kit, please contact Prezza Support or Sales respectively.

The major difference between accessing the API (what I call the "Core" API) this way and accessing it via web services is that to run the "Core" API you are essentially hosting an instance of the Checkbox application in your custom code. As a result, you must have an app.config and all configuration files properly set up for the code to run. It's a bit more work to get started and you have less of a clearly defined API. You also don't need to worry so much about internals of the application, such as always making sure to call UserManager.Initialize() before authenticating users or calling methods that perform security checks.

To use the web services, you simply need a reference to the WebServicesProxy.dll and you're off and running. The web services wrap common functionality in simpler method calls and are also more consistent in terms of arguments and naming conventions.

In addition, the web services methods allow your API code to access a remote server. For example, we have a couple customers that host Checkbox on our servers, but use web services to synchronize user information that is maintained on their servers.

Finally, the web service methods and parameters are less likely to change than some Core API methods or other public methods exposed by Checkbox objects.
Reply With Quote
  #10 (permalink)  
Old 02-06-2008, 02:04 PM
Junior Member
 
Join Date: Feb 2008
Posts: 5
Default

Thank you for the information. We do have a copy of the developers kit, but I have only found documentation on the web services.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 07:31 PM.


SEO by vBSEO 3.2.0