Subject: Re: Having problems with LEN()...
and when that doesn't work, try it with 0's :)
On 6/26/07, Bobby Hartsfield [EMAIL PROTECTED] wrote:
Try Numberformat(var, '')
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-Original Message-
From
Use #numberformat(myReorderNumber, )# That will auto-prepend
0's if necessary
Chris Peterson
Gainey IT
Adobe Certified Advanced Coldfusion Developer
-Original Message-
From: Michael Stevens [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 1:21 PM
To: CF-Talk
Subject:
fails miserably and blows up are kinda vague. got an error message?
but a couple of points:
1) look up the numberFormat() function. you can pad a number with
leading zeros. seems cfset order_number = numberFormat(form.reorder,
'') / should be all the logic you need.
2) you've got
Do a conditional loop.
cfloop condition=Len(var) LT 8
cfset var = 0 var
/cfloop
Just keeps adding zeroes onto the front 'til the length is 8.
~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7
and when that doesn't work, try it with 0's :)
On 6/26/07, Bobby Hartsfield [EMAIL PROTECTED] wrote:
Try Numberformat(var, '')
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-Original Message-
From: Michael Stevens [mailto:[EMAIL PROTECTED]
You could try simplifying it with a CFSWTCH/CFCASE statement instead...
Or more simply:
cfset Order_Number = left(00, 8 - len(form.reorder)) form.reorder
or:
cfset Order_Number = repeatString(0, 8 - len(form.reorder)) form.reorder
or:
cfset Order_Number =
What do you mean by it fails miserably?. You could try simplifying it with a
CFSWTCH/CFCASE statement instead...
cfswitch expression=#len(form.reorder)#
cfcase value=4
cfset Order_Number = /
/cfcase
cfcase value=5
cfset
Hi Mike,
What do you mean by it fails miserably? Personally I would probably write
that differently because it does look a bit messy with so many len() checks.
Suggestions could be:
Use CFSWITCH/CFCASE. Although it would do the same thing as your if statements
it would be a lot cleaner and
Try Numberformat(var, '')
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
-Original Message-
From: Michael Stevens [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 26, 2007 1:21 PM
To: CF-Talk
Subject: Having problems with LEN()...
My page takes input
9 matches
Mail list logo