 <cfset attrLengthUnits="in,M,METERS,METER,FT,FEET,FOOT,KM,KILOMETER,KILOMETERS,MM,MILLIMETER,MILLIMETERS,CM,CENTIMETER,CENTIMETERS,MI,MILE,MILES,YD,YARD,YARDS,FM,FATHOM,FATHOMS"><cfset attrWeightUnits="G,GRAMS,GRAM,KG,KILOGRAM,KILOGRAMS,LB,POUND,POUNDS,OZ,OUNCE,OUNCES"><cfset attrTimeUnits="D,DAY,DAYS,H,HOUR,HOURS,M,MONTH,MONTHS,WEEK,WEEKS,YR,YEAR,YEARS"><cfset charattrschops="=,!"><cfset numattrschops="=,!,<,>">
 <cfif isdefined("abundance") and len(abundance) gt 0>
   <cfset mapurl = "#mapurl#&abundance=#abundance#">
-  <cfset basJoin = " #basJoin# INNER JOIN v_attributes tbl_abundance ON (#session.flatTableName#.collection_object_id = tbl_abundance.collection_object_id)">
-  <cfset basQual = " #basQual# AND tbl_abundance.attribute_type = 'abundance'">
-  <cfif session.flatTableName is not "flat"><cfset basQual = " #basQual# AND tbl_abundance.is_encumbered = 0"></cfif>
-  <cfif abundance neq "_">
+  <cfif compare(abundance,"NULL") is 0>
+      <cfset basQual = " #basQual# AND ConcatAttributeValue(flat.collection_object_id,"abundance") is null">
+  <cfelse>
+    <cfset basJoin = " #basJoin# INNER JOIN v_attributes tbl_abundance ON (#session.flatTableName#.collection_object_id = tbl_abundance.collection_object_id)">
+    <cfset basQual = " #basQual# AND tbl_abundance.attribute_type = 'abundance'">
+    <cfif session.flatTableName is not "flat"><cfset basQual = " #basQual# AND tbl_abundance.is_encumbered = 0"></cfif>
+    <cfif abundance neq "_">
     <cfset oper=left(abundance,1)>
     <cfif listfind(charattrschops,oper)>
       <cfset schTerm=ucase(right(abundance,len(abundance)-1))>

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

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

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

<cfif isdefined("clutch_size_of_nest_parasite") and len(clutch_size_of_nest_parasite) gt 0>
  <cfset mapurl = "#mapurl#&clutch_size_of_nest_parasite=#clutch_size_of_nest_parasite#">
  <cfif compare(clutch_size_of_nest_parasite,"NULL") is 0>
      <cfset basQual = " #basQual# AND ConcatAttributeValue(flat.collection_object_id,"clutch_size_of_nest_parasite") is null">
  <cfelse>
    <cfset basJoin = " #basJoin# INNER JOIN v_attributes tbl_clutch_size_of_nest_parasite ON (#session.flatTableName#.collection_object_id = tbl_clutch_size_of_nest_parasite.collection_object_id)">
    <cfset basQual = " #basQual# AND tbl_clutch_size_of_nest_parasite.attribute_type = 'clutch size of nest parasite'">
    <cfif session.flatTableName is not "flat"><cfset basQual = " #basQual# AND tbl_clutch_size_of_nest_parasite.is_encumbered = 0"></cfif>
    <cfif clutch_size_of_nest_parasite neq "_">
    <cfset oper=left(clutch_size_of_nest_parasite,1)>
    <cfif listfind(charattrschops,oper)>
      <cfset schTerm=ucase(right(clutch_size_of_nest_parasite,len(clutch_size_of_nest_parasite)-1))>
