bcemmett / SurveyMonkeyApi-v3

Library for querying SurveyMonkey's v3 API
MIT License
37 stars 24 forks source link

Issues mapping multiple answer open ended #78

Open ambiguiccoherence opened 4 years ago

ambiguiccoherence commented 4 years ago

Is there a working example of how to parse the answers from a multiple answer open ended question?

bcemmett commented 4 years ago

It's easiest to let the library do this for you, either by calling PopulateSurveyResponseInformation(surveyId) or by passing the survey's structure and a response to MatchResponseToSurveyStructure(survey, response). For each of the response's questions, that will populate the ProcessedAnswer property with an object implementing IProcessedResponse (in the case of "multiple answer open ended" questions, that object will be https://github.com/bcemmett/SurveyMonkeyApi-v3/blob/master/SurveyMonkey/ProcessedAnswers/OpenEndedMultipleAnswer.cs).

If you want to implement this yourself, you can see how the library does it and copy that. You can find it in MatchOpenEndedMultipleAnswer() at https://github.com/bcemmett/SurveyMonkeyApi-v3/blob/master/SurveyMonkey/SurveyMonkeyApi.DataProcessing.cs#L182, which is called by MatchResponseQuestionToSurveyStructure().