Hi all,
I have to display an alphanumeric field that may contain numbers (e.g., GPA's)
or text (e.g., "n/a"). I have no control over the input form, or the database,
so I have to work with whatever I'm given access to.
So, to format the display of that field, and hoping that the field will contain
a GPA, I have the following:
numberFormat(GPA, '9.999')
This works fine as long as the field has a number. For those cases were the
field can contain text, e.g., a "n/a" string, I tried to use the following:
<cfif isNumeric("GPA")>#numberFormat(GPA, '9.999')#<cfelse>#GPA#</cfif>
Obviously, this always displays the CFELSE portion because the original field
is not numeric.
So my question is, how can I check that all characters in the field are numbers
(between 0 to 9) and a comma or a dot, so that I can apply the numberFormat
part? (rememer I don't have access to editing the table, so I cannot make the
field a numeric one per se, which would be the best solution).
Any ideas or suggestions are welcome.
Regards,
Roberto Perez
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265989
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4