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)
 %
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

hejsan
Starting Member

37 Posts

Posted - 19 May 2001 :  16:33:59  Show Profile
Is there a way to calculate this:

Registered members:
Guys 43%
Girls 57%

stuF
Average Member

United Kingdom
561 Posts

Posted - 19 May 2001 :  17:10:42  Show Profile  Visit stuF's Homepage
not quite sure if its what youre looking for, but as part of a mod for stats you can view how many of the members are male/female
its here:
http://www.calvsa.net/snitz

Go to Top of Page

hejsan
Starting Member

37 Posts

Posted - 20 May 2001 :  08:17:42  Show Profile
No, that MOD is great, but I want to display male/female in %.


Maybe something like this?

Total = "SELECT COUNT(M_SEX) FROM FORUM.MEMBERS"
Total_FEMALE = "SELECT COUNT(*) FROM FORUM.MEMBERS WHERE M_SEX=Female"

Female = Total_female / Total * 100

But I can´t get it to work! I´m not that good in asp though!

Go to Top of Page

Nam_Trung
Starting Member

22 Posts

Posted - 20 May 2001 :  10:24:19  Show Profile
Hope this will work:
==========================
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_SEX FROM " & strMemberTablePrefix & "MEMBERS WHERE " & strMemberTablePrefix & "MEMBERS.M_SEX = 'Female'"
set rsMember = my_Conn.Execute(strSql)
FeMember = 0
while not rsMember.eof
FeMember = FeMember + 1
rsMember.MoveNext
wend

strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.M_SEX FROM " & strMemberTablePrefix & "MEMBERS WHERE " & strMemberTablePrefix & "MEMBERS.M_SEX = 'Male'"
set rsMember = my_Conn.Execute(strSql)
MaMember = 0
while not rsMember.eof
MaMember = MaMember + 1
rsMember.Movenext
wend

Female = FormatPercent((FeMember/(FeMember + MaMember) * 100),0)
Male = FormatPercent((MaMember/(FeMember + MaMember) * 100),0)
==============================
This will ignore the member who don't specified their sex. If you want to calculate the unspecified:

Replace:
====================
Female = FormatPercent((FeMember/(FeMember + MaMember) * 100),0)
Male = FormatPercent((MaMember/(FeMember + MaMember) * 100),0)
=================
With:
=================
strSql = "SELECT " & strTablePrefix & "TOTALS.U_COUNT FROM " & strTablePrefix & "TOTALS"
set rsMember = my_Conn.Execute(strSql)
ToMember = rsMember("U_COUNT")

Female = FormatPercent((FeMember/ToMember * 100),0)
Male = FormatPercent((MaMember/ToMember * 100),0)
Unspecified = FormatPercent(((ToMember - MaMember - FeMemeber)/ToMember * 100),0)
=================
Good luck

Nam Trung

Go to Top of Page

hejsan
Starting Member

37 Posts

Posted - 20 May 2001 :  11:29:12  Show Profile
It works great! Except for one thing...

Results:
Male: 4,783%
Female: 5,217%

(I do want Male: 47% and Female: 52%, and no decimals)



Edited by - hejsan on 20 May 2001 11:31:22
Go to Top of Page

hejsan
Starting Member

37 Posts

Posted - 20 May 2001 :  11:40:49  Show Profile
I tried this end it worked!

Female = FormatPercent((FeMember/(FeMember + MaMember) * 1.0),0)
Male = FormatPercent((MaMember/(FeMember + MaMember) * 1.0),0)

Go to Top of Page

big9erfan
Average Member

540 Posts

Posted - 20 May 2001 :  13:00:29  Show Profile
With the format to precent you do not need to multiply it by 100 b/c it does that within the function.



http://www.ugfl.net/forums
Go to Top of Page

Aznknight
Senior Member

USA
1373 Posts

Posted - 20 May 2001 :  18:20:00  Show Profile  Send Aznknight an AOL message  Send Aznknight an ICQ Message
getting percent once you have the figures isn't that hard. The thing is that M_sex is not a required field so it does not accurately reflect the right percentage.

- Alan
www.iamviet.com
www.calvsa.net
Snitz Resource
Go to Top of Page

hejsan
Starting Member

37 Posts

Posted - 16 June 2001 :  12:31:26  Show Profile
I made M_sex to a required field... :-)

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.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07