API question

Using the API I am trying to return results for a survey. One of the questions is drop down box, and when the answer is returned, I always get '1' for the answer. The answer is being saved correctly in your systems, I can review the quiz and see the answer. I am using a snip from your code to return an answer. The line of code is:

WSAnswerPickResponse pickResponse = answerResponse as WSAnswerPickResponse;
string responseValue = null;
responseValue = pickResponse.value.ToString();

answerResponse is being passed into the method as a WSAnswerResponse object.
1 person has
this question
+1
Reply
  • Dear Nick,

    I have passed your question to our technical department. For your reference the ticket number is SUP-10077.

    They have informed us that most likely you are getting answerResponse from FormResultManagementService.getResponse(respid, )questionId); or FormResultManagementService.getResponses() methods, and these methods return only answered responses, not all of them, in your case it is value =1 since only one answer option was selected.
    If you would like to get a result with the answer label, then you need to substitute getValue() with getAnswerId() and that will return answer_ID of the answered response. Then by FormDesignManagementService.getAnswer(answer_ID).getTitle() you will get the text response of the answer.

    Hope this information is useful.

    Please let us know if we may assist you with anything else.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Still not sure I understand, I am using your method exactly to pull info out of my survey:

    ///
    /// Gets the response value.
    ///
    /// The answer response.
    ///
    private static string GetResponseValue(WSAnswerResponse answerResponse)
    {
    WSAnswerPickResponse pickResponse = answerResponse as WSAnswerPickResponse;
    WSAnswerTextResponse textResponse = answerResponse as WSAnswerTextResponse;
    string responseValue = null;
    if (pickResponse != null)
    {
    responseValue = pickResponse.value.ToString();
    }
    else if (textResponse != null)
    {
    responseValue = textResponse.text;
    }
    return responseValue;
    }

    For a single line text response it returns the answer perfectly, but for my drop down box I am getting '1', no matter what was answered.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Justin (Senior Support Analyst) October 09, 2014 20:59
    Dear Nick,

    I have asked our technical team to take a look at what you have posted today and provide further advice / suggestions. We'll be sure to get back to you as soon as we have new information.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Dear Nick,

    Our technical team has informed us that WSAnswerPickResponse always returns '1' for question types: pickOne, pickOneComment, checkAll, dropDown, listBox.
    For rateDifferent WSAnswerPickResponse returns value=3 (where 3 is the number of the chosen scale.)
    WSAnswerTextResponse only returns text answers for such question types: singleLine, multiLine, numeric, that is why this query is working for you on a Single line text response question. If you would like to return the answer option label for Dropdown question type, please use the suggestions from our technical team above.

    Hope this information is useful.

    Let us know if we may assist you with anything else.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited