       <cfset basQual = " #basQual# AND tbl_maximum_standard_length.attribute_value #oper# '#schTerm#'">
     </cfif>
   </cfif>
+</cfif>
 </cfif>
 
 <cfif isdefined("maximum_total_length") and len(maximum_total_length) gt 0>
   <cfset mapurl = "#mapurl#&maximum_total_length=#maximum_total_length#">
-  <cfset basJoin = " #basJoin# INNER JOIN v_attributes tbl_maximum_total_length ON (#session.flatTableName#.collection_object_id = tbl_maximum_total_length.collection_object_id)">
-  <cfset basQual = " #basQual# AND tbl_maximum_total_length.attribute_type = 'maximum total length'">
-  <cfif session.flatTableName is not "flat"><cfset basQual = " #basQual# AND tbl_maximum_total_length.is_encumbered = 0"></cfif>
-  <cfif maximum_total_length neq "_">
+  <cfif compare(maximum_total_length,"NULL") is 0>
+      <cfset basQual = " #basQual# AND ConcatAttributeValue(flat.collection_object_id,"maximum_total_length") is null">
+  <cfelse>
+    <cfset basJoin = " #basJoin# INNER JOIN v_attributes tbl_maximum_total_length ON (#session.flatTableName#.collection_object_id = tbl_maximum_total_length.collection_object_id)">
+    <cfset basQual = " #basQual# AND tbl_maximum_total_length.attribute_type = 'maximum total length'">
+    <cfif session.flatTableName is not "flat"><cfset basQual = " #basQual# AND tbl_maximum_total_length.is_encumbered = 0"></cfif>
+    <cfif maximum_total_length neq "_">
     <cfset schunits="">
     <cfset oper=left(maximum_total_length,1)>
     <cfif listfind(numattrschops,oper)>

      <cfset basQual = " #basQual# AND tbl_maximum_total_length.attribute_value #oper# '#schTerm#'">
    </cfif>
  </cfif>
</cfif>

<cfif isdefined("middle_toe_length") and len(middle_toe_length) gt 0>
  <cfset mapurl = "#mapurl#&middle_toe_length=#middle_toe_length#">
  <cfset basJoin = " #basJoin# INNER JOIN v_attributes tbl_middle_toe_length ON (#session.flatTableName#.collection_object_id = tbl_middle_toe_length.collection_object_id)">
  <cfset basQual = " #basQual# AND tbl_middle_toe_length.attribute_type = 'middle toe length'">
  <cfif session.flatTableName is not "flat"><cfset basQual = " #basQual# AND tbl_middle_toe_length.is_encumbered = 0"></cfif>
  <cfif middle_toe_length neq "_">
    <cfset schunits="">
    <cfset oper=left(middle_toe_length,1)>
    <cfif listfind(numattrschops,oper)>

      <cfset basQual = " #basQual# AND upper(tbl_verbatim_preservation_date.attribute_value) #oper# '#ucase(escapeQuotes(schTerm))#'">
	</cfif>
  </cfif>
</cfif>
</cfif>

<cfif isdefined("weight") and len(weight) gt 0>
  <cfset mapurl = "#mapurl#&weight=#weight#">
  <cfif compare(weight,"NULL") is 0>
      <cfset basQual = " #basQual# AND ConcatAttributeValue(flat.collection_object_id,"weight") is null">
  <cfelse>
    <cfset basJoin = " #basJoin# INNER JOIN v_attributes tbl_weight ON (#session.flatTableName#.collection_object_id = tbl_weight.collection_object_id)">
    <cfset basQual = " #basQual# AND tbl_weight.attribute_type = 'weight'">
    <cfif session.flatTableName is not "flat"><cfset basQual = " #basQual# AND tbl_weight.is_encumbered = 0"></cfif>
    <cfif weight neq "_">
    <cfset schunits="">
    <cfset oper=left(weight,1)>
    <cfif listfind(numattrschops,oper)>
