'Only display the buttons if there are results that matched the filter criteria
If lngFilteredRespondents > 0 Then
'Display the Export Data button if the user is the owner or is an admin or if the user has been granted
'export data permission via report sharing
If IsUserOwnerOrAdmin(lngSurveyID) = True Then
%>
<a href="ExportData.asp?DisplayHeader=<%=SUR_HEADER_DISPLAY_ON%>&SurveyID=<%=lngSurveyID%>&SurveyName=<%=strTitle%>"><img border="0" alt="Export data to a CSV or Excel" name="btnExportData" src="Resources/Buttons/ExportData.gif"></a>
<%
ElseIf GetValueFromReportShareSessionString(SUR_REPORT_SHARE_FIELD_EXPORT_DATA) = SUR_BOOLEAN_POSITIVE Then
%>
<a href="ExportData.asp?DisplayHeader=<%=SUR_HEADER_DISPLAY_ON%>&SID=<%=Request.QueryString("SID")%>&SurveyID=<%=lngSurveyID%>&SurveyName=<%=strTitle%>"><img border="0" alt="Export data to a CSV or Excel" name="btnExportData" src="Resources/Buttons/ExportData.gif"></a>
<%
End If
'Display the button to the individual reports if the user has permission to view them
If Len(Request.QueryString("SID")) > 0 Then
%>
<a href="ResultsIndividual.asp?DisplayHeader=<%=Request.QueryString("DisplayHeader")%>&SID=<%=Request.QueryString("SID")%>&SurveyID=<%=lngSurveyID%>"><img border="0" alt="View individual results for this survey" name="btnIndividualResponses" src="Resources/Buttons/IndividualResponses.gif"></a>
<%
ElseIf CanUserViewIndividualReport(lngSurveyID) = True Then
%>
<a href="ResultsIndividual.asp?DisplayHeader=<%=Request.QueryString("DisplayHeader")%>&SurveyID=<%=lngSurveyID%>"><img border="0" alt="View individual results for this survey" name="btnIndividualResponses" src="Resources/Buttons/IndividualResponses.gif"></a>
<a href="ReportFilterList.asp?SurveyName=<%=Server.URLEncode(strTitle)%>&Nav=ResultsOverview&SurveyID=<%=lngSurveyID%>&DisplayHeader=<%=Request.QueryString("DisplayHeader")%>"><img border="0" alt="Manage filters for this survey" name="btnManageFilters" src="Resources/Buttons/ManageFilters.gif"></a>
'If the current question has subitems, query to obtain the list of subitems
If lngItemTypeID = SUR_ITEM_CONSTANT_SUM Or lngItemTypeID = SUR_ITEM_RANKING Or lngItemTypeID = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Or lngItemTypeID = SUR_ITEM_MATRIX_RATING_SCALE Or lngItemTypeID = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or lngItemTypeID = SUR_ITEM_MATRIX_TEXT_BOXES Or lngItemTypeID = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Then
'Depending on the type of question, process the results differently
If lngItemTypeID = SUR_ITEM_MULTISELECT_CHECKBOXES Or lngItemTypeID = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or lngItemTypeID = SUR_ITEM_SINGLE_SELECT_OPTIONS Then 'Radio buttons, checkboxes, dropdown
'Build a string of name/value pairs by looping through the question recordset (which also has pre-defined answers).
'This string is logically a collection of name/value pairs separated by semi-colons (;) in the format
'Vanilla;6;Chocolate;7;Strawberry;1. This section sets the collection to values of 0 for all possible answers.
'Also create a collection of answer ID's to answer text for displaying the results.
Do While lngItemID = rsQuestions("item_id")
'When adding each possible answer to the collection, initialize to 0
ElseIf lngItemTypeID = SUR_ITEM_OPEN_ENDED_ONE_LINE Or lngItemTypeID = SUR_ITEM_OPEN_ENDED_COMMENTS_BOX Or lngItemTypeID = SUR_ITEM_DATE Or lngItemTypeID = SUR_ITEM_NUMBER Or lngItemTypeID = SUR_ITEM_DATABASE_DROPDOWN Then 'Text
'Get the number of responses and non-responses
lngSkippedTotal = 0
lngTextResponseCount = 0
lngNumberTotal = 0
'If there are no more answers, the next question was not answered.
If lngItemTypeID = SUR_ITEM_OPEN_ENDED_ONE_LINE Or lngItemTypeID = SUR_ITEM_OPEN_ENDED_COMMENTS_BOX Or lngItemTypeID = SUR_ITEM_DATE Or lngItemTypeID = SUR_ITEM_DATABASE_DROPDOWN Then 'Text
<span class="Normal">No responses were entered for this question.</span>
</td>
<td align="center" class="WhiteBackgroundColor">
<span class="NormalBold">N/A</span>
</td>
<%
End If
%>
</tr>
<%
ElseIf lngItemTypeID = SUR_ITEM_TRUE_FALSE Or lngItemTypeID = SUR_ITEM_YES_NO Or lngItemTypeID = SUR_ITEM_MULTISELECT_CHECKBOXES Or lngItemTypeID = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or lngItemTypeID = SUR_ITEM_SINGLE_SELECT_OPTIONS Then
'This section displays the results for questions that have multiple pre-canned answer
'possibilities (checkboxes, dropdown, or radio buttons)
'Create an array of all the name value pairs for the answers
vaAnswers = Split(strAnswersCollection, "|")
'Get the total number of skipped items
For i = 0 To UBound(vaAnswers) Step 2
If vaAnswers(i) = SUR_ANSWER_TEXT_NULL Then
'If this entry is a null answer, it's a skipped answer, so record the total
'Only add a line break if there's another question
If Not rsQuestions.EOF = True Then
%>
<br>
<%
End If
'If the subitems recordset is open, close it for the next iteration
If lngItemTypeID = SUR_ITEM_CONSTANT_SUM Or lngItemTypeID = SUR_ITEM_RANKING Or lngItemTypeID = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Or lngItemTypeID = SUR_ITEM_MATRIX_RATING_SCALE Or lngItemTypeID = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or lngItemTypeID = SUR_ITEM_MATRIX_TEXT_BOXES Or lngItemTypeID = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Then