Hi! I have and existing .rdlc file where I display the grades of each students as well as the general average. I get general average like

=FormatNumber(Switch(Fields!YearLevel.Value="LC7" or 
Fields!YearLevel.Value="LC8",(IIF(Fields!SectionName.Value<>"1st Sec A" and 
Fields!SectionName.Value<>"2nd Sec A",
((Fields!Reading.Value * 1.2) + 
(Fields!English.Value * 1.5) + 
(Fields!Math.Value * 1.5) + 
(Fields!Science.Value * 1.8) + 
(Fields!Language.Value * 1.2) + 
(FormatNumber((Fields!TLE.Value * .70) + (Fields!Computer.Value * .30),0) * 1.2) + 
(Fields!MAPEH.Value * 1.2) + (Fields!CLE.Value * 0.9))/10.5,
((Fields!Reading.Value * 1.2) + 
(Fields!English.Value * 1.5) + 
(Fields!Math.Value * 1.5) + 
(Fields!Science.Value * 1.8) + 
(Fields!Language.Value * 1.2) + 
(FormatNumber((Fields!TLE.Value * .70) + (Fields!Computer.Value * .30),0) * 1.2) + 
(Fields!MAPEH.Value * 1.2) + 
(Fields!CLE.Value * 0.9) +  
(Fields!Earth_Science.Value * 1) + 
(Fields!Geometry.Value * 1)) /11.5   )),
Fields!YearLevel.Value="LC9",
(IIF(Fields!SectionName.Value<>"3rd Sec A" , 
((Fields!Reading.Value * 1.2) + 
(Fields!English.Value * 1.5) + 
(Fields!Math.Value * 1.5) + 
(Fields!Science.Value * 1.8) + 
(Fields!Language.Value * 1.2) + 
(FormatNumber((Fields!TLE.Value * .30) + 
(Fields!Computer.Value * .70),0) * 1.2) +
(Fields!MAPEH.Value * 1.2) +
(Fields!CLE.Value * 0.9))/10.5,
((Fields!Reading.Value * 1.2) + 
(Fields!English.Value * 1.5) + 
(Fields!Math.Value * 1.5) + 
(Fields!Science.Value * 1.8) + 
(Fields!Language.Value * 1.2) + 
(FormatNumber((Fields!TLE.Value * .30) + (Fields!Computer.Value * .70),0) * 1.2) + 
(Fields!MAPEH.Value * 1.2) + 
(Fields!CLE.Value * 0.9) +  
(Fields!Research1.Value * 1) + 
(Fields!Adv_Biology.Value * 1)) /12.5)),
Fields!YearLevel.Value="LC10",
(IIf(Fields!SectionName.Value<>"4th Sec A" and Fields!SectionName.Value<>"4th Sec B",
((Fields!Reading.Value * 1.2) + 
(Fields!English.Value * 1.5) + 
(Fields!Math.Value * 1.5) + 
(Fields!Science.Value * 1.8) + 
(Fields!Language.Value * 1.2) + 
(FormatNumber((Fields!TLE.Value * .30) + 
(Fields!Computer.Value * .70),0) * 1.2) + 
(Round((Fields!Music.Value * .30) + (Fields!APEH.Value * .70)) * 1.2) + 
(Fields!CLE.Value * 0.9) + 
(Fields!CAT.Value * 0.3))/10.8,
((Fields!Reading.Value * 1.2) + 
(Fields!English.Value * 1.5) + 
(Fields!Math.Value * 1.5) + 
(Fields!Science.Value * 1.8) + 
(Fields!Language.Value * 1.2) + 
(FormatNumber((Fields!TLE.Value * .30) + (Fields!Computer.Value * .70),0) * 1.2) + 
(Round((Fields!Music.Value * .30) + 
(Fields!APEH.Value * .70)) * 1.2) + 
(Fields!CLE.Value * 0.9) + 
(Fields!CAT.Value * 0.3) + 
(Fields!Adv_Chemistry.Value * 1) +
(Fields!Research2.Value * 1))/12.8))),3)

I want to display:
"1st Honor" if gen. ave is >=90 but all the subject grades must be >=90 also
"2nd Honor" if gen. ave is >=88 but all the subject grades must be >=88 also
"Third Honor" if gen. ave is >=85 but all the subject grades must be >=85 also

How do I do it?

thanks in advance.

Are they stored in Database? By the way, if all subjects are more than 90, then the average must be more than 90. So, you might as well as checking for each grade's subject, something like:

Dim Marks As Integer = 100
For i As integer = 0 To alSubject.Count -1
If Marks >= alSubject.Item(i)
Marks = alSubject.Item(i) 'Always get the lowest value, so that by knowing that any subject is 84 or below, it can exit this loop as this student will get no Honor / Fourth Honor etc.
End If
If Marks <=84 Then
Exit For
End If
Next
If Marks >= 85 and < 88 Then
'Result is 3rd Honor
ElseIf Marks >= 88 and < 90 Then
'Result is 2nd Honor
ElseIf Marks >= 90 Then
'Result is 1st Honor
End If

I know this is per student way of doing. But this is just an idea to get started.

some the of grades are stored in the database but others are computed on the fly...What I mean is...say for example the TLE and Computer subjects...the individual grades for TLE and Computer are in the database but I need to get 70% and 30% respectively to come up with the correct grade so i compute it on the fly...I understood your code but I need this to be .rdlc file...if then is not supported their I think.

some the of grades are stored in the database but others are computed on the fly...What I mean say for example the TLE and Computer subjects...the individual grades for TLE and Computer are in the database but I need to get 70% and 30% respectively to come up with the correct grade so i compute it on the fly...I understood your code but I need this to be .rdlc file...if then is not supported their I think.

It has nothing much to do with rdlc file (Without providing which software you used, nobody can help you much) and it has nothing much on database / on the fly issue as I can always get the 2 subject's result and calculate first B4 adding to this arraylist OR I can also use some mathematical operations in database (Out of this scope) so that whenever the DB is returned, it has considered the 70% & 30% weightage issue and using that value to store in the arraylist, followed by using the above method.

I'm sorry, I forgot to tell...I am using vb2005.

I'm sorry, I forgot to tell...I am using vb2005.

Facepalm. Nevermind, the rdlc should not be a big issue, as a text file or even executables can have weird extensions. (Certain "dlls" are supposed to be dlls, but they have a special extension file. Look for After Effects plugin the .AEX ones and you know what I meant.)

Well, then as I suggested:

Step 1: Get each grade from DB

Step 2: Get the details, IF the grade does not required to be calculated on the fly due to weightage issue, just add into the arraylist

Step 2a: If that grade has to be calculated on the fly, then calculate it on the fly, THEN add into the arraylist.

Step 3: Use the For Loop I have given on the first reply to get the final result.

Honestly, I am at lost...I dont know where will I put your suggestion....Do I need to do as custom code in the .rdlc file or have to do it as inline vb code?

Sorry...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.