Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
dictionary use. (calculating percents from items)
Old 08-17-2005, 07:19 AM dictionary use. (calculating percents from items)
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Hi,
Im tring to calculate the percentage value of items in a dictionary against a total portalCount.
My sub below works to : response.write("percentages calclulated")
but beyond that I am getting a server error.
Could someone please eye over the code to see what done wrong. I am assuming it is related to referencing 2 dictionaries maybe.

this sub is called from another sub whereby the dictionary stat is defined so I havnt passed it to this sub. (when i do anyway it errors)

Code:
sub getPercents(portalCount)  
     set stat = Server.CreateObject("Scripting.Dictionary")
     for i = 0 To stat.Count -1
	     perCent = (stat.item(i)/portalCount) * 100
	     perCentDictionary.Add elem,perCent	 
	 next	
	 response.write("percentages calclulated")
	 
	 For Each elem In perCentDictionary
	     response.write(elem)
		 response.write(",")
		 response.write(perCentDictionary(elem)) 
		 response.write("<br/>")
	 next	
end sub
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 08-17-2005, 04:54 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,522
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
1/ Where is perCentDictionary created ?

2/ what is the error ?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-18-2005, 05:12 AM
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
ok ive sorted this by simplifying things. thanks though for you input.
Steve
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Reply     « Reply to dictionary use. (calculating percents from items)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.10720 seconds with 12 queries