ASP Classic - count numbers if the number matches, then assign that number to the folder.

Hello all;

OK, I need to count some numbers, and if the number matches, then assign that number to the folder.

This is the Image folders. (yes, the X is in the name of the folders)
000XXXXX
001XXXXX
002XXXXX
003XXXXX
004XXXXX
005XXXXX
006XXXXX
007XXXXX
008XXXXX
009XXXXX
01XXXXXX
02XXXXXX
03XXXXXX
04XXXXXX
05XXXXXX
06XXXXXX
07XXXXXX
08XXXXXX
09XXXXXX
1XXXXXXX
2XXXXXXX
3XXXXXXX
4XXXXXXX
5XXXXXXX
6XXXXXXX
7XXXXXXX
9XXXXXXX

Open in new window


These are some sample of the images, corresponding with their folder names.
001XXXXX
00100000.jpg
00101934.jpg
00103153.jpg
00199013.jpg

Open in new window

002XXXXX
00202549.jpg
00287068.jpg
00298070.jpg

Open in new window

09XXXXXX
09970234.jpg
09971079.jpg
09971795.jpg

Open in new window

1XXXXXXX
13523105.jpg
14002020.jpg
14050044.jpg
14050054.jpg

Open in new window


This will get the number of leading 0s.
<%strCLID = "00102348"%>
<%getCount = len(strCLID)-len(clng(strCLID)) &"-"& strCLID%>
getCount = 2

Open in new window


And for the long number: 14050054
The result is
-1

So, it would need to be something like this.

<%
if strNum="13523105" then
getFolder = "1XXXXXXX"
elseif strNum="03523105 then
getFolder = "03XXXXXX"
if strNum="93523105" then
getFolder = "9XXXXXXX"
if strNum="00523105" then
getFolder = "00XXXXXX"
elseif ......etc...
%>
This will be used in the image link
<img src="graph/item/<%=getFoldre%>/<%=getImage%>" />

Open in new window


Any ideas on this one?

Thanks, All
Carrzkiss
LVL 31
Wayne BarronAuthor, Web DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
i was sort of following you up to this point:

And for the long number: 14050054
The result is
-1

tell me if I'm understanding you right. You have a bunch of folders, all named with a format like:

1234XXXXXXX

where 1234 can be any length of numbers and is some kind of identifier that links back to the file name. it sounds like you want to be able to determine the number of zeros before you get to an actual number (I don't understand the why part of this), After this, I'm lost on what you're trying to do.

Can you explain, in a general overview, what you want to accomplish?
0
Wayne BarronAuthor, Web DeveloperAuthor Commented:
Hey, BigMonty.
Long time, hope you are doing well.

The Folders that I have listed in the TA, are the actual folder names in the directory.
All the images together, equal to around 25GB
That is a LOT of images, that I do not want in a single folder.
SO, I am leaving them in their default folders, and have in code, for the Number
That is filtered through SQL to ASP, to let the page know which folder to serve the image(s) up from.

So, as demonstrated here.
<%
' If the number is 13523105, then we need to assign the folder, with the same amount of characters, with the leading 1, so in this case, would be 1XXXXXXX.
if strNum="13523105" then
getFolder = "1XXXXXXX"
elseif strNum="03523105 then
getFolder = "03XXXXXX"
if strNum="93523105" then
getFolder = "9XXXXXXX"
if strNum="00523105" then
getFolder = "00XXXXXX"
elseif ......etc...
%>
This will be used in the image link
<img src="graph/item/<%=getFoldre%>/<%=getImage%>" />

Open in new window


Hope that clears it up.
I kept going over and over what I was writing and should have left certain things out that I had tested.
But, I wanted to show what I had found on my own.
0
Wayne BarronAuthor, Web DeveloperAuthor Commented:
I updated the Image folder list.
The top folder = 000XXXXX
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Wayne BarronAuthor, Web DeveloperAuthor Commented:
Got it.
So, I have my granddaughter staying the evening with me, and she decided to wake up.
And well, did not want to go back to sleep. (5-months old)
Oh well, minus well go into the office and see if I can get some things done.
And wa-la.
Figured it out.

if left(strCLID,3)="000" then
theImage = "000XXXXX"
elseif left(strCLID,3)="001" then
theImage = "001XXXXX"
elseif left(strCLID,3)="002" then
theImage = "002XXXXX"
end if
etc...

Open in new window


Works like a charm.
even ran the shortest number against it, and it returned the proper folder for it.

All good here.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
sorry i didnt get back to you, had a hectic couple of days. anyways, glad you figured it out :)
0
Wayne BarronAuthor, Web DeveloperAuthor Commented:
Not a problem, BigMonty.
Have an awesome rest of the week.
0
Wayne BarronAuthor, Web DeveloperAuthor Commented:
Figured it out on my own.
Cope supplied in the accepted comment.

Carrzkiss
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.