Homepage / Doc / Export Responses

Export Responses

The ExportReponsesTabular method will return filtered or unfiltered response data in the format of an IEnumerable SimpleNameValueCollection format which is easy to write to CSV files or insert into databases. The Name will always be the question or property, and the value will always be the answer or value of the field.

As of the 2017 Q2 release, this method will always return at least one response even if there are no responses that match the filter. If no response data matches the filters Checkbox will return a blank response with an id of 0. This is being done to keep the return of the method uniform.
class Test
{
    static void Main()
    {
        var client = new ResponseDataServiceClient();
        var responseData = client.ExportResponsesTabular(authToken, 2297, 1, 3, "UniqueIdentifier", "admin", "",
            true, 1, DateTime.Now.AddYears(-1), DateTime.Now.AddYears(1), false, false, false, false, false, false,
            false, false, false, false);

        if (!responseData.CallSuccess)
        {
            Console.WriteLine(responseData.FailureMessage);
            return;
        }

        foreach (var responses in responseData.ResultData.ResultPage.Responses)
        {
            foreach (var response in responses.NameValueList)
            {
                var output = string.Format("Question  : {0} Answer  : {1}", response.Name, response.Value);
                Console.WriteLine(output);
            }
        }
        // Always close the client.
        client.Close();
    }
}

Input Parameters

Parameter Type Description
authToken string Authentication token to validate permission over the data requested
surveyId int Survey Identifier this is either a 4 or 5 digit number
pageNumber int Page number to pull from responses supplying 0 will pull all pages at once
resultsPerpage int Number of results to pull into a single page of responses
filterField string Field to filter response data on. Valid values are : UniqueIdentifier, Invitee, ResponseID, Guid, RespondentGuid
filterValue string Value to filter the FilterField on
sortField string Field to sort the data returned on. Valid values are : UniqueIdentifier, Invitee, ResponseID, Guid, RespondentGuid, StartDate. This value cannot be “null”
sortAscending bool True will sort the data ascending, false will sort the data descending
period int Value should be equal to 1 (Field is used internally)
dtStart DateTime DateTime to be used as the response Start date
dtEnd DateTime DateTime to be used as the response End Date
DetailedReponseInfo bool True will pull detailed response information which includes response meta data
DetailedUserInfo bool True will pull detailed user information such as the entire user profile of the respondents
IncludeOpenEndedResults bool True will pull open ended responses. False will not include any single line or multi line questions / answers
IncludeAliases bool True will replace Questions / Answers with alias values. If no alias value is present for a question it will pull the full question / answer text
IncludeHiddenItems bool True will pull hidden item data collected from the “Hidden Item Page” of the survey
IncludeIncompleteResponses bool True will pull all incomplete responses. Incomplete responses cannot be filtered on by EndDate. This means that if this is set to true, all responses will be pulled regardless of start date.
StripHTMLTagsFromAnswers bool True will remove all styling and HTML code from response answers
StripHTMLTagsFromQuestions bool True will remove all styling and HTML code from survey questions
MergeAnswersForSelectMany bool True will return checkbox item answers in the format of A,B,C where A B C are all options for the question. False will return checkbox item answers in seperate key-value pairs.
includeScoreData bool True will return detailed scoring information such as total score, score per page, and possible score per page
May 9, 2017