<span class="H2HeadingStyle">Report Filters for '<%=strSurveyName%>' Survey</span>
</td>
<td width="1" rowspan="25"> </td>
</tr>
<tr>
<td valign="top" height="44">
<span class="Normal">
Add as many report filters to this survey as desired. The overview and individual reports will then
display only those responses that match <i>all</i> of the filters listed below.
</span>
</td>
</tr>
</table>
<table border="0" cellpadding="6" cellspacing="0" width="740" class="WhiteBackgroundColor" summary="This page displays a list of all report filters for the selected survey.">
<%
'Create a recordset of all the questions for this survey. This recordset is used inside the loop
'for report filters to create a combo of questions to pick from.
<input type="checkbox" <% If rsReportFilters("active_yn") = SUR_BOOLEAN_POSITIVE Then Response.Write "checked" End If %> name="chkActive<%=lngCurrentReportFilterID%>" id="chkActive<%=lngCurrentReportFilterID%>">
</td>
<td align="center">
<a href="javascript:deleteReportFilter('<%=lngCurrentReportFilterID%>');"><img alt="Delete this report filter" border="0" src="Resources/Icons/Delete.gif" onMouseOver="this.style.cursor='hand'"></a>
<option <% If strCurrentFilterType = SUR_REPORT_FILTER_TYPE_DATE Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_TYPE_DATE%>"><%=SUR_REPORT_FILTER_TYPE_DATE%></option>
<%
'Only display the hidden field option in the dropdown if the survey has hidden fields
If CLng(GetHiddenFieldCount(lngSurveyID)) > 0 Then
%>
<option <% If strCurrentFilterType = SUR_REPORT_FILTER_TYPE_HIDDEN_FIELD Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_TYPE_HIDDEN_FIELD%>"><%=SUR_REPORT_FILTER_TYPE_HIDDEN_FIELD%></option>
<%
End If
%>
<option <% If strCurrentFilterType = SUR_REPORT_FILTER_TYPE_QUESTION Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_TYPE_QUESTION%>"><%=SUR_REPORT_FILTER_TYPE_QUESTION%></option>
<option <% If strCurrentFilterType = SUR_REPORT_FILTER_TYPE_USER_ATTRIBUTE Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_TYPE_USER_ATTRIBUTE%>"><%=SUR_REPORT_FILTER_TYPE_USER_ATTRIBUTE%></option>
</select>
</td>
</tr>
<%
'Display the appropriate set of input controls, depending on the filter type selected
If strCurrentFilterType = SUR_REPORT_FILTER_TYPE_DATE Then
'--9/26/05 added & "" to end of CStr because of invalid use of null error with CStr.
%>
<option <% If CStr(lngHiddenFieldID & "") = CStr(rsHiddenFields("hidden_field_id") & "") Then Response.Write "selected" End If %> value="<%=rsHiddenFields("hidden_field_id")%>"><%=rsHiddenFields("hidden_field_display_name")%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%></option>
</select>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%></option>
</select>
<%
'Capture the answer text for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("txtAnswer" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_COMPANY Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_COMPANY%>"><%=SUR_USER_ATTRIBUTE_TYPE_COMPANY%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_1 Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_1%>"><%=SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_1%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_2 Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_2%>"><%=SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_2%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_3 Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_3%>"><%=SUR_USER_ATTRIBUTE_TYPE_CUSTOM_DATA_3%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_EMAIL_ADDRESS Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_EMAIL_ADDRESS%>"><%=SUR_USER_ATTRIBUTE_TYPE_EMAIL_ADDRESS%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_FIRST_NAME Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_FIRST_NAME%>"><%=SUR_USER_ATTRIBUTE_TYPE_FIRST_NAME%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_LAST_NAME Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_LAST_NAME%>"><%=SUR_USER_ATTRIBUTE_TYPE_LAST_NAME%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_LOCATION Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_LOCATION%>"><%=SUR_USER_ATTRIBUTE_TYPE_LOCATION%></option>
<option <% If strUserAttributeType = SUR_USER_ATTRIBUTE_TYPE_POSITION Then Response.Write "selected" End If %> value="<%=SUR_USER_ATTRIBUTE_TYPE_POSITION%>"><%=SUR_USER_ATTRIBUTE_TYPE_POSITION%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%></option>
</select>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%></option>
</select>
<%
'Capture the answer text for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("txtAnswer" & CStr(lngCurrentReportFilterID))) > 0 Then
'Display the appropriate row heading depending on the type of question
If CLng(lngItemTypeID) = SUR_ITEM_SINGLE_SELECT_DROPDOWN Or CLng(lngItemTypeID) = SUR_ITEM_DATABASE_DROPDOWN Or CLng(lngItemTypeID) = SUR_ITEM_SINGLE_SELECT_OPTIONS Or CLng(lngItemTypeID) = SUR_ITEM_MULTISELECT_CHECKBOXES Or CLng(lngItemTypeID) = SUR_ITEM_YES_NO Or CLng(lngItemTypeID) = SUR_ITEM_TRUE_FALSE Then
%>
<span class="Normal">Select answer</span>
<%
ElseIf CLng(lngItemTypeID) = SUR_ITEM_CONSTANT_SUM Or CLng(lngItemTypeID) = SUR_ITEM_RANKING Or CLng(lngItemTypeID) = SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS Or CLng(lngItemTypeID) = SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES Or CLng(lngItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Or CLng(lngItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Or CLng(lngItemTypeID) = SUR_ITEM_MATRIX_RATING_SCALE Then
%>
<span class="Normal">Select row</span>
<%
Else
%>
<span class="Normal">Include records</span>
<%
End If
%>
</td>
<td>
<%
Select Case CLng(lngItemTypeID)
Case SUR_ITEM_DATE, SUR_ITEM_NUMBER
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%></option>
</select>
<%
Case SUR_ITEM_OPEN_ENDED_ONE_LINE, SUR_ITEM_OPEN_ENDED_COMMENTS_BOX
'Capture the first operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorFirst" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%></option>
</select>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%></option>
</select>
<%
Case SUR_ITEM_YES_NO
'Capture the answer text for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboAnswer" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strAnswerText = SUR_YES_NO_QUESTION_VALUE_NO Then Response.Write "selected" End If %> value="<%=SUR_YES_NO_QUESTION_VALUE_NO%>"><%=SUR_YES_NO_QUESTION_VALUE_NO%></option>
<option <% If strAnswerText = SUR_YES_NO_QUESTION_VALUE_YES Then Response.Write "selected" End If %> value="<%=SUR_YES_NO_QUESTION_VALUE_YES%>"><%=SUR_YES_NO_QUESTION_VALUE_YES%></option>
</select>
<%
Case SUR_ITEM_TRUE_FALSE
'Capture the answer text for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboAnswer" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strAnswerText = SUR_TRUE_FALSE_QUESTION_VALUE_FALSE Then Response.Write "selected" End If %> value="<%=SUR_TRUE_FALSE_QUESTION_VALUE_FALSE%>"><%=SUR_TRUE_FALSE_QUESTION_VALUE_FALSE%></option>
<option <% If strAnswerText = SUR_TRUE_FALSE_QUESTION_VALUE_TRUE Then Response.Write "selected" End If %> value="<%=SUR_TRUE_FALSE_QUESTION_VALUE_TRUE%>"><%=SUR_TRUE_FALSE_QUESTION_VALUE_TRUE%></option>
</select>
<%
Case SUR_ITEM_SINGLE_SELECT_DROPDOWN, SUR_ITEM_SINGLE_SELECT_OPTIONS, SUR_ITEM_MULTISELECT_CHECKBOXES
'Check to see if the answer selected was for the "Other" choice
If rsReportFilters("other_yn") = SUR_BOOLEAN_POSITIVE Then
lngAnswerID = SUR_CONTROL_OTHER
Else
'If there is no subitem ID in either the database or a submitted form, use
'the first subitem
lngAnswerID = rsReportFilters("answer_id")
If IsNull(lngAnswerID) = True Or Len(Trim(lngAnswerID)) = 0 Then
lngAnswerID = rsAnswers("answer_id")
End If
End If
End If
'Capture whether or not this question has an "Other" option
If rsAnswers("other_yn") = SUR_BOOLEAN_POSITIVE Then
flgRenderOtherOption = True
Else
flgRenderOtherOption = False
End If
%>
<select style="width:256px" name="cboAnswer<%=lngCurrentReportFilterID%>" id="cboAnswer<%=lngCurrentReportFilterID%>" onChange="javascript:answerSelected(this.value, '<% If CStr(lngAnswerID) = SUR_CONTROL_OTHER Then Response.Write "True" Else Response.Write "False" End If %>');">
<%
Do While Not rsAnswers.EOF
%>
<option <% If CStr(rsAnswers("answer_id")) = CStr(lngAnswerID) Then Response.Write "SELECTED" End If %> value="<%=rsAnswers("answer_id")%>"><%=rsAnswers("answer_text")%></option>
<%
rsAnswers.MoveNext
Loop
rsAnswers.Close
'If there is an "Other" choice, add it to the dropdown
If flgRenderOtherOption = True Then
%>
<option <% If lngAnswerID = SUR_CONTROL_OTHER Then Response.Write "selected" End If %> value="<%=SUR_CONTROL_OTHER%>"><%=SUR_CONTROL_OTHER%></option>
<%
End If
%>
</select>
<%
'If the "Other" choice was selected, display the controls for the "Other". Make sure this is not a
'dropdown, which it could appear to be if switching from a checkbox or option control that had "Other"
'selected.
If lngAnswerID = SUR_CONTROL_OTHER And CLng(lngItemTypeID) <> SUR_ITEM_SINGLE_SELECT_DROPDOWN Then
%>
</td>
<tr>
<tr>
<td>
<span class="Normal">Include records</span>
</td>
<td>
<%
'Capture the answer text for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("txtAnswer" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%></option>
</select>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%></option>
</select>
<%
End If
Case SUR_ITEM_DATABASE_DROPDOWN
'Select the SQL and database connection for this question
strSQL = "SELECT database_sql, database_dsn " & _
"FROM sur_item " & _
"WHERE item_id = " & lngCurrentItemID
Set rsItemDetails = conReportFilter.Execute(ConvertSQL(strSQL), , adCmdText)
rsItemDetails.MoveFirst
strDatabaseSQL = rsItemDetails("database_sql")
strDatabaseDSN = rsItemDetails("database_dsn")
rsItemDetails.Close
Set rsItemDetails = Nothing
'Select all of the answers for the question
On Error Resume Next
conItemDetails.Open strDatabaseDSN
If Err.number = 0 Then
Set rsAnswers = conItemDetails.Execute(ConvertSQL(strDatabaseSQL), , adCmdText)
If Err.number <> 0 Then
flgAnswersExist = False
End If
Else
flgAnswersExist = False
End If
On Error GoTo 0
%>
<select style="width:256px" name="cboAnswer<%=lngCurrentReportFilterID%>" id="cboAnswer<%=lngCurrentReportFilterID%>" onChange="javascript:answerSelected(this.value, '<% If CStr(lngAnswerID) = SUR_CONTROL_OTHER Then Response.Write "True" Else Response.Write "False" End If %>');">
<%
'If there are answers to display, render them
If flgAnswersExist = True Then
rsAnswers.MoveFirst
'Capture the answer text for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboAnswer" & CStr(lngCurrentReportFilterID))) > 0 Then
'If there is no postback, use the first answer in the list
strAnswerText = rsReportFilters("answer_text")
If IsNull(strAnswerText) = True Or Len(Trim(strAnswerText)) = 0 Then
strAnswerText = rsAnswers("ItemValue")
End If
End If
Do While Not rsAnswers.EOF
%>
<option <% If CStr(rsAnswers("ItemValue")) = CStr(strAnswerText) Then Response.Write "selected" End If %> value="<%=rsAnswers("ItemValue")%>"><%=rsAnswers("ItemDisplay")%></option>
<%
rsAnswers.MoveNext
Loop
End If
'Clean up
If flgAnswersExist = True Then
rsAnswers.Close
End If
Set conItemDetails = Nothing
%>
</select>
<%
Case SUR_ITEM_RANKING, SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES
<option <% If CStr(rsSubItems("subitem_id")) = CStr(lngSubItemID) Then Response.Write "selected" End If %> value="<%=rsSubItems("subitem_id")%>"><%=rsSubItems("subitem_text")%></option>
<%
rsSubItems.MoveNext
Loop
rsSubItems.Close
%>
</select>
</td>
</tr>
<tr>
<td>
<span class="Normal">Include records</span>
</td>
<td>
<%
If CLng(lngItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Then
'Capture the first operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorFirst" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%></option>
</select>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%></option>
</select>
<%
Else 'Ranking question
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%></option>
</select>
<%
'Capture the numeric ranking value for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboRanking" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If CStr(rsSubItems("subitem_id")) = CStr(lngSubItemID) Then Response.Write "selected" End If %> value="<%=rsSubItems("subitem_id")%>"><%=rsSubItems("subitem_text")%></option>
<%
rsSubItems.MoveNext
Loop
rsSubItems.Close
%>
</select>
</td>
</tr>
<tr>
<td>
<span class="Normal">Include records</span>
</td>
<td>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%></option>
</select>
<%
Case SUR_ITEM_MATRIX_SINGLE_SELECT_OPTIONS, SUR_ITEM_MATRIX_MULTISELECT_CHECKBOXES
<option <% If CStr(rsSubItems("subitem_id")) = CStr(lngSubItemID) Then Response.Write "selected" End If %> value="<%=rsSubItems("subitem_id")%>"><%=rsSubItems("subitem_text")%></option>
<option <% If CStr(rsAnswers("answer_id")) = CStr(lngAnswerID) Then Response.Write "SELECTED" End If %> value="<%=rsAnswers("answer_id")%>"><%=rsAnswers("answer_text")%></option>
<%
rsAnswers.MoveNext
Loop
rsAnswers.Close
%>
</select>
<%
Case SUR_ITEM_MATRIX_RATING_SCALE
'Capture the subitem ID for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboSubItem" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If CStr(rsSubItems("subitem_id")) = CStr(lngSubItemID) Then Response.Write "selected" End If %> value="<%=rsSubItems("subitem_id")%>"><%=rsSubItems("subitem_text")%></option>
<%
rsSubItems.MoveNext
Loop
rsSubItems.Close
%>
</select>
</td>
</tr>
<tr>
<td>
<span class="Normal">Include records</span>
</td>
<td>
<%
If CLng(lngItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Then
'Capture the first operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorFirst" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%></option>
</select>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%></option>
</select>
<%
Else 'Ranking question
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_GREATER_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_EQUAL%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_LESS%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%>"><%=strOperatorPrefix & SUR_REPORT_FILTER_OPERATOR_SECOND_LESS_EQUAL%></option>
</select>
<%
'Capture the numeric ranking value for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboRanking" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If CStr(rsSubItems("subitem_id")) = CStr(lngSubItemID) Then Response.Write "selected" End If %> value="<%=rsSubItems("subitem_id")%>"><%=rsSubItems("subitem_text")%></option>
<option <% If CStr(rsAnswers("answer_id")) = CStr(lngAnswerID) Then Response.Write "SELECTED" End If %> value="<%=rsAnswers("answer_id")%>"><%=rsAnswers("answer_text")%></option>
<%
rsAnswers.MoveNext
Loop
rsAnswers.Close
%>
</select>
</td>
</tr>
<tr>
<td>
<span class="Normal">Include records</span>
</td>
<td>
<%
'Capture the first operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorFirst" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT%></option>
<option <% If strOperatorFirst = SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%>"><%=SUR_REPORT_FILTER_OPERATOR_FIRST_THAT_DO_NOT%></option>
</select>
<%
'Capture the second operator for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("cboOperatorSecond" & CStr(lngCurrentReportFilterID))) > 0 Then
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_CONTAIN%></option>
<option <% If strOperatorSecond = SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH Then Response.Write "selected" End If %> value="<%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%>"><%=SUR_REPORT_FILTER_OPERATOR_SECOND_MATCH%></option>
</select>
<%
End Select
'Display a text box for entering open-ended values
If CLng(lngItemTypeID) = SUR_ITEM_MATRIX_TEXT_BOXES Or CLng(lngItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_OR_MORE_LINES Or CLng(lngItemTypeID) = SUR_ITEM_OPEN_ENDED_ONE_LINE Or CLng(lngItemTypeID) = SUR_ITEM_OPEN_ENDED_COMMENTS_BOX Or CLng(lngItemTypeID) = SUR_ITEM_DATE Or CLng(lngItemTypeID) = SUR_ITEM_NUMBER Or CLng(lngItemTypeID) = SUR_ITEM_CONSTANT_SUM Or (lngAnswerID = SUR_CONTROL_OTHER And CLng(lngItemTypeID) <> SUR_ITEM_SINGLE_SELECT_DROPDOWN)Then
'For numbers and dates, make sure that the data is in a valid format
If CLng(lngItemTypeID) = SUR_ITEM_DATE Then
'Capture the answer text for the current record, to use for comparisons. If the field is
'in the form due to a postback, use the form field. Otherwise, use the field from the database.
If Len(Request.Form("txtAnswerDate" & CStr(lngCurrentReportFilterID))) > 0 Then
<a href="javascript:insertFilter();"><img border="0" alt="Insert a new report filter" name="btnInsertFilter" src="Resources/Buttons/InsertFilter.gif"></a>
<a href="ResultsOverview.asp?DisplayHeader=<%=Request.QueryString("DisplayHeader")%>&SurveyID=<%=lngSurveyID%>"><img border="0" alt="View summary results for this survey" name="btnResultsOverview" src="Resources/Buttons/ResultsOverview.gif"></a>
<%
If lngReportFilterCount > 0 Then
%>
<a href="javascript:submitCheck();"><img border="0" alt="Save all report filters" name="btnSave" src="Resources/Buttons/Save.gif"></a>