This doesn�t take into account that you may reach ZZ will you actually have
that many on one project? It seems like it would throw your whole numbering
out of whack if so anyway. I definitely agree with Claude (Im sure you do
too) but if you can manage to start with a new schema it would save a lot of
future headache... like actually having 01000AA - 01000ZZ and needing
another since the number seems to be more of a main project indicator and
the letters revisions or changes/updates... anyway... 

This will increment the letters AA - AZ and roll AZ to BA. It's by no means
perfect either but it's not 1000 lines of code :)


<cfquery name="jobnum" datasource="mydsn" maxrows="1">
select * from q order by jobid desc
</cfquery>

<cfset alpha = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z">

<cfset LastJobNumber = jobnum.jobnumber>

<cfset FirstLetter = ucase(left(right(LastJobNumber, 2), 1))>
<cfset LastLetter = ucase(right(ucase(LastJobNumber), 1))>
<cfset NumberPrefix = rereplace(LastJobNumber, "[^0-9]", "", "ALL")>

<cfif LastLetter is "Z">
        <cfset NewLastLetter = "A">
        <cfset IncrementFirst = true>
<cfelse>
        <cfset LastLetterPosition = ListFind(alpha, LastLetter)>
        <cfset NewFirstLetter = FirstLetter>
        <cfset NewLastLetter = ListGetAt(alpha, LastLetterPosition+1)>
        <cfset IncrementFirst = false>
</cfif>

<cfif IncrementFirst>
        <cfset FirstLetterPosition = ListFind(alpha, FirstLetter)>
        <cfset NewFirstLetter = ListGetAt(alpha, FirstLetterPosition+1)>
</cfif>

<cfoutput>#NumberPrefix##NewFirstLetter##newLastLetter#</cfoutput>

-----Original Message-----
From: SStewart [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 18, 2005 2:34 PM
To: CF-Talk
Subject: Anyone know of a more elegant way to do this?

I'm incrementing a project number, it's an alpha-numeric "number"  (001000A
or 001000AA) if it's a new project I just grab the first six numbers and
increment, if it's an extended project I have to increment the letter with
the next one.

My code works but it's kind of a battering ram approach, is there a more
elegant way to do this?

Thanks

sas

<cfif Right(qry_getLastPnum.lPnum,2) CONTAINS "A">
        <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"B">
        <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "B">
                <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"C">
        <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "c">
                <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"D">
        <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "D">
                <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"E">
        <cfelseif Right(qry_getLastPnum.lPnum,2) CONTAINS "E">
                <cfset lPnum = Left(qry_getLastPNum.lPnum,6)&"F">

Scott A. Stewart, 
Web Application Developer
 
Engineering Consulting Services, Ltd. (ECS)
14026 Thunderbolt Place, Suite 300
Chantilly, VA 20151
Phone: (703) 995-1737
Fax: (703) 834-5527


-----Original Message-----
From: Adkins, Randy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 18, 2005 11:08 am
To: CF-Talk
Subject: RE: Good Site Stats Tag Recommendation
Importance: Low

I like the look of Statistex however, I was going to obtain 
The full version but the wellmanweb site does not exist any
Longer.

I know awstats is off of sourceforge and is free, just never
Was able to get mine to work.

Sorry.. My 2 cents

-----Original Message-----
From: Steve Kahn [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 18, 2005 11:05 AM
To: CF-Talk
Subject: Good Site Stats Tag Recommendation

Anyone have a good site stats tag recommendation?

Thanks Steve







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:207093
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to