I am using a rule in Coldfusion to tabulate the values of several input fields to verify that they equal 100. This works with whole numbers, but the rule fires if decimal numbers are entered, even when they add up to 100. I inserted the total value into the message string and the warning will say, "These values should add up to 100%, current total is 100". Here is the code for the rule, and also a screenshot showing the result when I enter: 80, 18, 1.5, .1, .1, and .3
Not sure what the problem is...
<!--- Tabulate race --->
<cfif isNumeric(form.whitePct)>
<cfset race += #form.whitePct#>
</cfif>
<cfif isNumeric(form.blackPct)>
<cfset race += #form.blackPct#>
</cfif>
<cfif isNumeric(form.asianPct)>
<cfset race += #form.asianPct#>
</cfif>
<cfif isNumeric(form.paciPct)>
<cfset race += #form.paciPct#>
</cfif>
<cfif isNumeric(form.amerIndPct)>
<cfset race += #form.amerIndPct#>
</cfif>
<cfif isNumeric(form.othPct)>
<cfset race += #form.othPct#>
</cfif>
<!--- Q60 - Numbers for this question should total 100% --->
<cfif race neq '100'>
<cfset queryAddRow(queryLog)>
<cfset querySetCell(queryLog,"ruleField","whitePct")>
<cfset querySetCell(queryLog,"ruleMessage","Q60 - Numbers for this question should total 100%, current total is #race#")>
<cfset querySetCell(queryLog,"ruleGUID","A5DC7FDD-6624-4B0F-A99B-2589B8CBC07D")>
<cfset querySetCell(queryLog,"ruleType","soft warning")>
<cfset querySetCell(queryLog,"ruleCategory","RANGE")>
<cfset querySetCell(queryLog,"ruleOrder","410")>
<cfset querySetCell(queryLog,"ruleID","1484")>
</cfif>
Edit: This problem seems to be specifically associated with these numbers in this order. When I enter: .1, .1, .3, 1.5, 18, 80 - the rule does not fire. Now I'm even more confused.