cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing values

Former Member
0 Kudos

Post Author: MTrusing

CA Forum: General

I am trying to compare returned values in my report so that I can identify duplicate records in our database. I have used the PreviousValue function before, but I don't believe that is what I need here. I'm wanting to compare each row in my report to the previous and next rows that are returned. Can anyone shed some light on this for me?

Accepted Solutions (0)

Answers (12)

Answers (12)

Former Member
0 Kudos

Post Author: MTrusing

CA Forum: General

Next and Previous duplicates are now being highlighted. Interestingly enough though, in some cases, there are more than two consecutive duplicate records. I don't know of a function that will look before the Previous record and/or after the Next record.

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

To highlight both of the duplicates, you need:

IF {table.field} = NEXT({table.field}) OR {table.field} = PREVIOUS({table.field}) ...

Former Member
0 Kudos

Post Author: MTrusing

CA Forum: General

Thank you. I will try that.

Former Member
0 Kudos

Post Author: MTrusing

CA Forum: General

Thank you so much for your help. I had been going to that area of the Section Expert, but did not know the correct functions to use. Applying that function highlights the duplicate record. (I am trying to identify all records with duplicate addresses.) Is there also a way to highlight both records that are the same? Right now it is highlighting a second record if it matches the one before it.

Former Member
0 Kudos

Post Author: Jagan

CA Forum: General

What constitutes a duplicate record? Can you group on something such that you'd only expect one detail record per group, and then use the count function to check if there's >1 in the group and colour accordingly?

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

Within the section formatter find the area for Background Color and click on the formula box.

Enter the formula: IF {table.field} = PREVIOUS({table.field}) then crYellow else NoColor

Former Member
0 Kudos

Post Author: MTrusing

CA Forum: General

I am actually attempting to apply conditional formatting (shading all rows where a duplicate value exists). I have gone into Section Expert, and want to apply the formatting to the Detail section. Once I am in the Detail section of the Section Expert, where do I actually enter the formula to compare current field to previous values? When I type If {table.field} = Previous({table.field}), Crystal is looking for the formula result to either be a number, or it tells me it is looking for a "then".

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

If you're using it for print suppression, then you need to go to the Section Expert.

Former Member
0 Kudos

Post Author: MTrusing

CA Forum: General

Thank you for responding. So I do need the Previous command after all. Should this formula be done within the Section Expert?

Former Member
0 Kudos

Post Author: Charliy

CA Forum: General

If {table.field} = Previous({table.field}) ...

or you could use next

If you're using it for suppression, put Not(onfirstrecord) in the formula before the other comparisons.

Former Member
0 Kudos

Post Author: MTrusing

CA Forum: General

I am using Crystal 9 (Professional)

Former Member
0 Kudos

Post Author: colin mackenzie

CA Forum: General

What version of Crystal Reports Developer are you using?