Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Last record in a group (puzzled) Post Reply Post New Topic
Author Message
IanShorrock
Newbie
Newbie


Joined: 25 Jan 2008
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote IanShorrock Replybullet Topic: Last record in a group (puzzled)
     Posted: 02 Oct 2009 at 5:39am
Hi,

I am using Crystal 9 to extract data from a Syteline ERP system. I am accessing a table which logs production planning transactions for each manufactured item. I need the report to replicate the exact record sort order that is visible on the screen so that I can perform a calculation on the most recent record for each item. The screen sort order also happens to be the way the database displays the records in Enterprise Manager. So, Easy you may say !

   When I pull all the records from the table into the report the record sort order matches the screen and database as you would expect. When I group the report on item the sort order remains correct so that when I move the required field from Detail into the Group Footer it will display the last record for each item. I can then perform the calculation and hide the details - job done.

However when I add a selection parameter so that I can select a single item or a range of items the sort order changes so that the last record for each item in the report no longer matches the last record on screen or out of the database. It does not do this for all records just odd ones making the report un-reliable. There is a date field in the table but it is not time stamped so I cannot use it to guarantee sorting chronologically.

My Question Why would adding a selection parameter alter the sort order of the records ? The report is just grouped on Item, there is no other selection, grouping or sorting going on in the report. Why would it only re-sort on certain records ?

Is there code to guarantee that Crystal displays records in the order that they come from the database ?

Thanks for any assistance

IanS
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 02 Oct 2009 at 6:10am
on the group you can specify the order...in orginal order sounds like what you want.
 
don't know why it would resort, unless the selection process reorders the data to skip items.
 
You could try using a stored proc, it shouldn't mess with the order, though I wouldn't have thought that CR would either.
IP IP Logged
IanShorrock
Newbie
Newbie


Joined: 25 Jan 2008
Location: United Kingdom
Online Status: Offline
Posts: 9
Quote IanShorrock Replybullet Posted: 02 Oct 2009 at 7:08am

Thanks lockwelle for your quick reply, I did try using original order. For some of the erroneous items it corrected the sort order but for others which were previously OK it messed them up.

Anyway I have just this afternoon managed to get the report error free. I discovered that the Syteline ERP screen used about 5 different fields to sort the data not just the date. When I sorted my report on all 5 fields then the data matched.

However I would still like to try and understand why the addition of a parameter field would change the sort order on certain records, on what was a very simple report.

IanS
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum