crystal-reports

Crystal Report reference value from one row in another row


I'm trying to write a report where if Value A in Row 1 is equal to Value B in Row 2, then display Value A from Row 2 in Row 1. If there are multiple matches then add another row. Value A and B are from two different tables.

So, currently I have:

Value A Value B
12345
67890 12345
13579 12345

And I want it to be:

Value A Value B Value C
12345 67890
12345 13579
67890 12345
13579 12345

I'm struggling with how to reference data from one row in another row. Any help is appreciated.

Tried both a command and a formula to no avail.


Solution

  • The simplest alternative is to outer-join Value A in <Table> to column B in <Table2> where Table2 is the alias of the same table (in Crystal Designer, simply add the same table twice. The 2nd copy would require an alias).
    This would result in the following result set:
    enter image description here

    Let the report simply display all columns except the 3rd.