 		<cfquery name="fattrorder" datasource="uam_god">
 			select max(DISP_ORDER) mdo from ssrch_field_doc
 		</cfquery>
-		<cfset n=ceiling(fattrorder.mdo) +1>			
+		<cfset n=ceiling(fattrorder.mdo) +1>
 		<cfset variables.encoding="UTF-8">
 		<cfset variables.f_srch_field_doc="#Application.webDirectory#/download/srch_field_doc.sql">
 		<cfset variables.f_ss_doc="#Application.webDirectory#/download/specsrch.txt">
 		<cfset x='<!---Autogenerated by /Admin/buildAttributeSearchByNameCode.cfm. Do not manually modify this file.---->' & chr(10)>
 		<!---- get all units code tables, plus ass in the stuff we can guess via eg, to_meters function ---->
 		<cfset canconvert="M,METERS,METER,FT,FEET,FOOT,KM,KILOMETER,KILOMETERS,MM,MILLIMETER,MILLIMETERS,CM,CENTIMETER,CENTIMETERS,MI,MILE,MILES,YD,YARD,YARDS,FM,FATHOM,FATHOMS">
-		
+
 		<cfquery name="ctlu" datasource="uam_god">
 			select length_units from ctlength_units where upper(length_units) not in (#listqualify(canconvert,"'")#) group by length_units
 		</cfquery>
 		<cfset attrLengthUnits=valuelist(ctlu.length_units)>
 		<cfset attrLengthUnits=listappend(attrLengthUnits,canconvert)>
-		
-		
-		
-		
+
+
+
+
 		<cfset canconvert="G,GRAMS,GRAM,KG,KILOGRAM,KILOGRAMS,LB,POUND,POUNDS,OZ,OUNCE,OUNCES">
 		<cfquery name="ctwu" datasource="uam_god">
 			select weight_units from ctweight_units where upper(weight_units) not in (#listqualify(canconvert,"'")#)  group by weight_units
 		</cfquery>
 		<cfset attrWeightUnits=valuelist(ctwu.weight_units)>
 		<cfset attrWeightUnits=listappend(attrWeightUnits,canconvert)>
-		
-		
+
+
 		<cfset canconvert="D,DAY,DAYS,H,HOUR,HOURS,M,MONTH,MONTHS,WEEK,WEEKS,YR,YEAR,YEARS">
 		<cfquery name="cttu" datasource="uam_god">
 			select NUMERIC_AGE_UNITS time_units from CTNUMERIC_AGE_UNITS  where upper(NUMERIC_AGE_UNITS) not in (#listqualify(canconvert,"'")#)  group by NUMERIC_AGE_UNITS

			variables.josrch_field_doc.writeLine("delete from ssrch_field_doc where CATEGORY='attribute';#chr(10)#");
			variables.f_ss_doc = createObject('Component', '/component.FileWriter').init(variables.f_ss_doc, variables.encoding, 32768);
			variables.f_ss_doc.writeLine(x);
		</cfscript>	
		<cfloop query="d">
			<cfquery name="tctl" datasource="uam_god">
				select 
					CTATTRIBUTE_TYPE.ATTRIBUTE_TYPE,
					CTATTRIBUTE_TYPE.DESCRIPTION,
					ctattribute_code_tables.VALUE_CODE_TABLE,
					ctattribute_code_tables.UNITS_CODE_TABLE 
				from 
					CTATTRIBUTE_TYPE,
					ctattribute_code_tables
				where 
					CTATTRIBUTE_TYPE.ATTRIBUTE_TYPE=ctattribute_code_tables.ATTRIBUTE_TYPE (+) and
					CTATTRIBUTE_TYPE.ATTRIBUTE_TYPE='#ATTRIBUTE_TYPE#'
				group by
					CTATTRIBUTE_TYPE.ATTRIBUTE_TYPE,
					CTATTRIBUTE_TYPE.DESCRIPTION,
					ctattribute_code_tables.VALUE_CODE_TABLE,
					ctattribute_code_tables.UNITS_CODE_TABLE  
			</cfquery>
			<cfset attrvar=lcase(trim(replace(replace(replace(ATTRIBUTE_TYPE,' ','_','all'),'-','_','all'),"/","_","all")))>
			<cfif len(tctl.VALUE_CODE_TABLE) gt 0>

		<p>
			Get the SQL to update ssrch_field_doc <a href="/download/srch_field_doc.sql">here</a>
		</p>

		<p>
			Get the CFML to build /includes/SearchSql_attributes.cfm <a href="/download/specsrch.txt">here</a>
		</p>

		<p>To avoid strange fractions and gaps, run this, commit, and then reload this page.</p>
<textarea rows="10" cols="100">
declare
  n number;
  begin
    n:=1;
