add shades in crystal report

tapai_rhino

Member
Joined
Jan 13, 2006
Messages
16
Programming Experience
Beginner
hi,
i been testing with vb.net and crystal report.
Let's say that in a crystal report i have produce a table as below:
mark1 mark2 mark3
student a 10 13 23
student b 15 12 34
student c 5 10 34


how can i add shades to 2 of the lowest marks in crystal report?...
 
I may be able to get you started.
I haven't quite figured out your exact application but I can give you an idea on which way to go.

First you need to have a group defined that will encompass all report records. A group which all records are a member of. You will need this for the N-Smallest function.

Next, you will format the field Mark1 on the Detail Line to have a background. Right click ==> Format ==> Border - Under the conditional format [x-2] use this:
Basic Syntax

if {Mark1}= NthSmallest (1, {Mark1}, {GroupField}) then
formula = crYellow
else
if {Mark1}= NthSmallest (2, {Mark1}, {GroupField}) then
formula = crYellow
else
formula = crWhite
end if
end if

Highlight the
{Mark1} & {GroupField} then doubleclick on your report fields to replace them with correct field names.
This will highlight the two smallest values for Mark1 yellow (includes ties). I don't know how to do the smallest 2 out of all the marks combined. The above code is using the Summary Function (NthSmallest). NthSmallest (2 means the second smallest not the 2 smallest.
You may be able to manipulate that function and it's evaluation time to include all marks - again, this is beyond my skill at this point.

Hope this helps get you pointed in the right direction.
 
thanks david...

I haven't quite figured out your exact application
im developing a scoring system where it will keep all the student score... this data will be saved in sql server database... when a user extract the data in the crystal report, it will shade the 2 lowest mark the student get..
 
Think about this database structure:
A Table called Students - key field is Student_Id
Contains Name, Address and everything about the student.

A second Table called Scores - Key fields Score_Id (Autoincrement) and Student_ID
Contains Scores, Dates, Class, Comments and stuff relating to the Score.

The tables are linked on Student_Id so in your report would group by Student_ID, you would have the Name and address and stuff in the Group Header. Then In the detail section the code above would work. There would be multiple Score records for each student and you could find the lowest 2 scores for each student. This also gives you the ability to get a report for only one student depending on the report's record selection on the Students Dataset. Select a Student, pass the report the Student_Id and get that record from the Student Table.

I think it will be much easier to add stuff to your project if you develop it driven off the Student Table and use Student_ID as a link to other tables.

Just trying to help
 
Back
Top