Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing a value in a column against another value in the same column

Status
Not open for further replies.

kabtjb

Technical User
Dec 2, 2003
8
US
Hello!

I am working with Crystal 8.5 and in one of my reports I'm trying to compare a value in a specific column against the other values in the same column. If the value is unique then I want to shade that row otherwise I want to do nothing. Example: I am looking at a column called Med_Rec and within that column I want to compare the current focus med rec number with the entire Med_Rec Column and continue this until every med rec num has been checked against one another in the report.

Here is the code I have now and nothing is happening:

If {vst_v.vst_med_rec_no} <> {vst_v.vst_med_rec_no} then crYellow
Else crNoColor

Any suggestions?
 
Nothing is happening because you're comparing the field to itself. Is the column one of your groups? If so, you could do a count on it and modify the color of the group footer based on whether the count was 1 or >1. You also might be able to do something with a shared variable and a subreport that would count the number of records for you.

-D
 
Thanks for getting back to me, but no, this column is not part of a group. I need to be able to take a med rec no from January and compare that med rec no to the med rec no's in the months prior to January. I don't care if the med rec no shows up twice in January or after January I only want the med rec no to be shaded in January if it was in the months prior to January.

 
Looks like you will have to use a sub-report, and link the field in the main report to a group in the subreport, and check to see if the count is greater than 0.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top