Create a section on PatientID, sort the section on it. Create a formula vCountPatient to count the patient id and reset the count for each patient id(group level). Based on the formula vCountPatient suppress the section if the count is <=1. You should get all the duplicates.
I have found a much more easy way to include ONLY rows having a duplicate field. Go Insert … --> Section --> Details --> Check on “Suppress (no drill down)”
Insert this formula:
previous({FIELD}) <> {FIELD} AND next({FIELD}) <> {FIELD}
This basically suppress any row having a field value that differs from the previous one AND the subsequent one, achieving the same result without even grouping or counting.
Liked your formula. I inserted it into a couple of reports, and it worked perfectly.
One caveat I found, however, the values in the field must be sorted. After adding the field into the Record Sort Expert, the formula you suggested worked perfectly!
AND
(toText({eWRServiceOrders.Order Number}) + {eWRServiceOrderChemicals.Material Code}) <> (toText(next ({eWRServiceOrders.Order Number})) + next ({eWRServiceOrderChemicals.Material Code}))
This essentially converts the order number to a string then concatenates it with the material code, then compares the result to the rows above/below. What I end up with is two entries of the same line.