title: Comparing Records In Crystal Reports
body: <p>So I want to compare some records in Crystal Reports to take care of a problem a bug in our system has caused. </p>
  
  <p>So every once in a while our system charges someone twice. I want to find all those orders/shipments. An order can have multiple shipments (if we have one item on backorder we ship out the rest of the order in one shipment and then ship out the backordered item in another shipment). The shipment also has a <code>charge_date</code> field that's a date time stamp when we charged the customer. So if we grouped it in Crystal reports it would look like this:</p>
  
  <pre><code>    Order Id: 234587
                Shipment Id: 121    charge_date: 8/29/2012 11:43:21
                Shipment Id: 524    charge_date: 9/1/2012 15:37:39
  </code></pre>
  
  <p>Shipments are created in numerical order. So if we send out one shipment, say shipment number: 345, then the next shipment we send out, regardless of what order it's a part of, will be shipment number: 346.</p>
  
  <p>So, when someone is a victim of our bug then their shipments are right after one another and their <code>charge_date</code> are exactly the same. Like so:</p>
  
  <pre><code>    Order Id: 69875
                Shipment Id: 594     charge_date: 9/2/2012 14:32:15
                Shipment Id: 595     charge_date: 9/2/2012 14:32:15
  </code></pre>
  
  <p>I can create a list of just shipments and their charge date (without grouping on Order Id) and sorting them in ascending order. But what I want to do is iterate through the list of shipments and compare each shipment to the previous shipment and see if the <code>charge_date</code>'s are equal and if they are then select them or mark them or something so that I can group them by a formula and take care of them. </p>
  
  <p>Is this possible in Crystal? Should I use a different program? I realize this might not be the best way to do this so I'm open to suggestions. Thanks in advance!</p>