Skip to Content
author's profile photo Former Member
Former Member

Comparing values

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?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

12 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 23, 2007 at 05:47 PM

    Post Author: colin mackenzie

    CA Forum: General

    What version of Crystal Reports Developer are you using?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 23, 2007 at 05:54 PM

    Post Author: MTrusing

    CA Forum: General

    I am using Crystal 9 (Professional)

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 23, 2007 at 05:58 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 23, 2007 at 06:46 PM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 23, 2007 at 07:49 PM

    Post Author: Charliy

    CA Forum: General

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 23, 2007 at 09:45 PM

    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".

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 23, 2007 at 10:06 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 24, 2007 at 04:51 AM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 24, 2007 at 01:14 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 24, 2007 at 01:14 PM

    Post Author: MTrusing

    CA Forum: General

    Thank you. I will try that.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.