Crystal Report Sorting/Grouping

jspc
jspc used Ask the Experts™
on
Hello,

Can you please help me with the sorting/grouping of this Crystal Report file?

I have a crystal report; purchase order file.
The original entry of the data was in the order of product code 1003, 1006, 1005. (Screen shot attached, EntryInDatabaseOrderExample)
When you view the Purchase Order in CR PDF the order of product code 1005, 1006, 1003 (PDF Attached)

I can’t figure out why the order in the crystal file isn’t in the same order as how it was entered into the database.

Attached is the file saved with data. Look at PO Number PO00136.

Thank you.
EntryInDatabaseOrderExample.png
StructuredPurchaseOrder.pdf
StructuredPurchaseOrder.rpt
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mike McCrackenSenior Consultant
Most Valuable Expert 2011
Top Expert 2013

Commented:
YOur report has 2 groups
Group 1 - Document Number
Group 2 - Formula - Structured Group
                        totext({TRANSDETAILS.ZStrStkItemView})  + totext({TRANSDETAILS.ForeignUnitPrice})

Groups serve as sorting fields so your report is sorted by Document Number then within each Document Number group the records are sorted by the Structured Group formula

If you want it sorted by the Product code you need to
1.  Group on the product code rather than the Structured Group
2.  You can try to convert the productCode to a number - Val({ProductCode})
      Insert in in the detail section
      Right click it
      Click INSERT --> SUMMARY
      Set Summary to SUM
       Insert it in the GF2
      Click REPORT --> GROUP SORT EXPERT
       Change None to ALL
      Select the Sum of ProductCodeValue as the sort field

mlmcc

Author

Commented:
No, not by Product Code, it needs to be sorted by how it was entered into the database. (Order entry)

Also I cannot convert Product Code to a number as this field contains both numbers and alpha.
Senior Consultant
Most Valuable Expert 2011
Top Expert 2013
Commented:
Try taking the 2nd group out.  If that doesn't work I don't think it is possible unless you add a field to the database to indicate the order

mlmcc
You have a LineNumber field.  If that reflects the order in which the items were added, then you would theoretically want to sort by that before your StructuredGroup formula (eg. add a group on LineNumber and put it above the group on StructuredGroup).  However, when I tried that, it seemed to change the output on your report pretty drastically, so I suspect that that isn't the answer in this case.

 James

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial