Hi all......

Here is my requirement. I am clear with my logic. But i am blocked at Code. How can i get this...

Here is the example...
I need to produce a Score card.
Where i need to calculate score of a dealer as per Question category and the Customers reply.
I am trying to clear my Need here.
Suppose The data is as Follows
1) dealer "A"
2) Question Category "1"
3) Number Of question in Category "1" = 2
4) Marks for Question = 1 (N) else 4(Y)

If Dealer "A" has 4 customers and 2 of them replied then.

Here are the Inputs for Scorecard.

1) Total Question for Dealer "A" of Category "1" => 2(Customers) * 2 (Questions) = 4
2) Marks = 4 * 4 = 16 (Considering Y case)
3) Total Marks = 16

Here the score of Dealer "A" is "100%" MI right? If yes then please tell me how to get this by calculation. Please Help me.

Thanks in advance.

Have a Nice Time. :)

10 Years
Discussion Span
Last Post by sbv

FYI. i am trying to implement this with crystal report and view.


Not sure exactly what you mean here, but for your info, for calculating it easily, avoid 1 and 4 for yes and no.

Use 0 for no, 1 for yes. This way:
2 questions right, 2 questions wrong
0 + 2 = 2
2/4 = 50%

For 1 and 4, you are looking at some intense calculation, or substituting like the following:
if 1 then 0, if 4 then 1.

You can do it anyway you wish, but if they get it wrong, do NOT add any points. Otherwise your calculations will be just about impossible.

If you wish, keep it 0 and 4. Then just divide by 4.

2 right, 2 wrong
(Total Points) / (Points per correct answer * number of questions)

Something like this would work for your current situation:

Dim y As Integer = 0
Dim n As Integer = 0
Dim Questions() As String = {1,4,4,1,4,4,4,4,1,4}

For Each answer As Integer In Questions
  Select Case answer
    Case 1 : n += 1
    Case 4 : y += 1
  End Select

Dim percentRight As Decimal = FormatNumber((y/(n+y))*100, 1)

Response.Write(percentRight & "%")

Now if you had it 0 for no, 1 for yes, then all you would have to do is count each element and sum them all up.

Then divide the sum by the total count and you would have it. Make sure it's decimal, as if you put integer, it will round to the nearest whole number.

An example of this would be:

Dim Questions() As String = {0,1,1,0,1,1,1,1,0,1}

Dim percentRight As Decimal = FormatNumber((Questions.Sum()/Questions.Length)*100, 1)

Response.Write(percentRight & "%")

Thanks for reply. But i need to develop this all in Crystal report as i told. i need to design and develop a score card.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.