Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/O Code)
 Displaying Archived Stats in Statistice Area
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Striker
Starting Member

4 Posts

Posted - 14 March 2002 :  19:47:13  Show Profile
In default.asp, the following code is "remmed" out. If you remove the rems, it adds a line to stats, but the count is VERY much off. On my website, update counts tells me I have around 11,000 archived messages, but this code tells me I have like 200,000. The board isn't that busy. Has anyone been able to make this code work properly?

	ArchivedPostCount = 0
ArchivedTopicCount = 0
' if not blnHiddenForums then
'## Forum_SQL - Get ActiveTopicCount from DB
' strSql = "SELECT COUNT(" & strArchiveTablePrefix & "REPLY.REPLY_ID) AS NUM_REPLY_ARCHIVED, " &_
' "COUNT(" & strArchiveTablePrefix & "TOPICS.TOPIC_ID) AS NUM_TOPIC_ARCHIVED " &_
' " FROM " & strArchiveTablePrefix & "REPLY, " &_
' strArchiveTablePrefix & "TOPICS "
'
' Set rs = Server.CreateObject("ADODB.Recordset")
' rs.open strSql, my_Conn

' if not rs.EOF then
' ArchivedPostCount = rs("NUM_REPLY_ARCHIVED") + rs("NUM_TOPIC_ARCHIVED")
' ArchivedTopicCount = rs("NUM_TOPIC_ARCHIVED")
' else
' ArchivedPostCount = 0
' ArchivedTopicCount = 0
' end if
' end if

' rs.close
' set rs = nothing


RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 14 March 2002 :  20:11:04  Show Profile
try this:

	ArchivedPostCount = 0
ArchivedTopicCount = 0
if not blnHiddenForums then
'## Forum_SQL
strSql = "SELECT P_A_COUNT, T_A_COUNT FROM " & strTablePrefix & "TOTALS"

Set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql, my_Conn

if not rs.EOF then
ArchivedPostCount = rs("P_A_COUNT")
ArchivedTopicCount = rs("T_A_COUNT")
else
ArchivedPostCount = 0
ArchivedTopicCount = 0
end if

rs.Close
set rs = nothing
end if
Go to Top of Page

Striker
Starting Member

4 Posts

Posted - 14 March 2002 :  20:26:21  Show Profile
Perfect and works like a charm. Thanks !!!

Wouldn't happen to know how to get it to put a comma in the right place so:

There are 11045 archived posts in 1146 archived topics

Reads as:

There are 11,045 archived posts in 1,146 archived topics



Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 14 March 2002 :  21:09:35  Show Profile  Visit Nathan's Homepage
The computer is printing numbers, not strings. The computer doesn't think of numbers as having commas, they are just numbers.

If you want commas you can make a function that converts the number into a string then counts the number of digits in the string and inserts commas at the approprate locations. (Don't ask me how to do this though, I have never sat down and learned how to use the VBScript string manipulation functions.)

  Nathan Bales - Romans 15:13
----------------------------------

Snitz Exchange | Do's and Dont's
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 14 March 2002 :  21:20:48  Show Profile
maybe something like this:

http://line9.com/tek9.asp?pg=freebies&specific=53
Go to Top of Page

Striker
Starting Member

4 Posts

Posted - 14 March 2002 :  21:36:04  Show Profile
Ok ... that worked ... added a function to the end of default.asp and run the numbers through it. Much easier in regular VB with the Format command

Thanks for all the help Richard!

Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  21:44:06  Show Profile  Visit Gremlin's Homepage
wouldn't this have been easier ?


ArchivedPostCount = FormatNumber(rs("P_A_COUNT"),0)


www.daoc-halo.com

Edited by - Gremlin on 14 March 2002 21:46:58
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 14 March 2002 :  22:02:33  Show Profile
I was looking at that here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vsfctformatnumber.asp

But it doesn't come right out and say that it will insert the commas. But after reading it again, I understand now...
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  22:06:09  Show Profile  Visit Gremlin's Homepage
Not exactly the clearest documentation there is it !

According to my book it will use the regional settings for numeric display, which I guess normally would be commas for most languages.

www.daoc-halo.com
Go to Top of Page

Nathan
Help Moderator

USA
7664 Posts

Posted - 15 March 2002 :  01:03:57  Show Profile  Visit Nathan's Homepage
Grab a pre-made function off the internet. . . . why didn't I think of that!

  Nathan Bales - Romans 15:13
----------------------------------

Snitz Exchange | Do's and Dont's
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 15 March 2002 :  01:24:45  Show Profile  Visit Gremlin's Homepage
I dunno, but theres an inbuilt function that does it anyway Nathan

www.daoc-halo.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.27 seconds. Powered By: Snitz Forums 2000 Version 3.4.07