1

I'm working on a Crystal Report for Shipments and I'm struggling with the following:

I have Shipments with 2 Shipment Detail records, one for LOAD and one for DISCHARGE. When grouped by shipment and load type (for sorting in descending order - Load then Discharge) the detail section looks like this:

Shipment-----------load type------------Location

1001---------------LOAD-----------------New York
1001---------------DISCHARGE--------Chicago

I now want to hide the detail section and display one row/sentence in the group or report footer reading:
"Shipment 1001 from New York to Chicago"

How can I do this?
I tried stringvars and all sorts of things, I can concatenate it to list both locations separated by a comma, I tried nthlargest and nthsmallest location, but I can't get it into the right sequence.

If Crystal worked with embedded SQL I would say
"Shipment " + {shipment.ID} + " from " + (select location from shipment where loadtype = 'LOAD') + " to " + (select location from shipment where loadtype = 'DISCHARGE')

Any ideas? Thanks!

4

1 回答 1

0

You can use the Previous function to find a value in the previous row.

Assuming you only ever have two records per shipment ID, you can create a formula with the following code, and place it in your group footer (replacing your table and field names as necessary):

"Shipment " & ToText ({YourTable.Shipment}, "0") & " from " 
    & Previous ({YourTable.Location}) & " to " & {YourTable.Location}
于 2012-10-23T15:27:54.977 回答