...answers when you need them
866-430-8274    1-617-715-9605
  • Free Version
  • Contact Us
  • Login

Checkbox Forums

Register | Help
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    alanjc45 Guest

    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.

  2. #2
    ncushing is offline Administrator
    Join Date
    Mar 2007
    Location
    Prezza Technologies
    Posts
    207

    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");
        }
      }
    }

  3. #3
    alanjc45 Guest

    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.

  4. #4
    alanjc45 Guest

    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

  5. #5
    ncushing is offline Administrator
    Join Date
    Mar 2007
    Location
    Prezza Technologies
    Posts
    207

    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.

  6. #6
    rtrainer is offline Junior Member
    Join Date
    Feb 2008
    Posts
    5

    Default Assemblies

    What assembly needs to bew referenced to use the above code?

  7. #7
    ncushing is offline Administrator
    Join Date
    Mar 2007
    Location
    Prezza Technologies
    Posts
    207

    Default

    The ResponseManager class is in the Checkbox.Forms namespace which is contained in the Checkbox assembly.

  8. #8
    rtrainer is offline 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?

  9. #9
    ncushing is offline Administrator
    Join Date
    Mar 2007
    Location
    Prezza Technologies
    Posts
    207

    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.

  10. #10
    rtrainer is offline 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Feedback

SEO by vBSEO 3.5.0