Crystal Report Sorting/Grouping

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
jspcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike McCrackenSenior ConsultantCommented:
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
jspcAuthor 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.
Mike McCrackenSenior ConsultantCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
James0628Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.