0

I have a dataset (TADODataset) that feeds into an in memory dataset(TdxMemData) which is assigned to a datasource (TDataSource). When I run the program and the SQL is not ordered by anything, the three records returned are displayed on 3 separate report pages (ReportBuilder). However when I order by a field, The first two records of the report are appended together and only the final record displays correctly.

This is cryptic and not very informative, but I'm trying to see if I am missing something simple. The code shouldn't produce different results because I ordered the SQL but it is. It leads me to believe I have missed a setting for the component. Does anyone know of any issues that could be caused by sorting a SQL DataSet and the way it could interact with an In memory dataset? I am very new to using these component types and am just looking for someone with more experience than me to let me know where I should take this. Any help would be greatly appreciated, and if anything is unclear I will try to clarify. Thanks in advance.

Update 8.14.2013:

SQL statement (before Order By):

SELECT r.RecordID, r.VisibleRouteID, r.DriverSideStudentsPerSeat,
       r.ServiceSideStudentsPerSeat, v.Vehicle, v.DriverSideRows, 
       v.ServiceSideRows, v.RecordID AS VehicleID 
FROM Route r
LEFT OUTER JOIN Vehicles v ON v.RecordID = r.VehicleID
WHERE r.RecordID = :RouteID 

SQL Statement (After Order By has been added):

SELECT r.RecordID, r.VisibleRouteID, r.DriverSideStudentsPerSeat,
       r.ServiceSideStudentsPerSeat, v.Vehicle, v.DriverSideRows, 
       v.ServiceSideRows, v.RecordID AS VehicleID 
FROM Route r
LEFT OUTER JOIN Vehicles v ON v.RecordID = r.VehicleID
WHERE r.RecordID = :RouteID
ORDER BY r.VisibleRouteID
Jan Doggen
  • 8,799
  • 13
  • 70
  • 144
CodeMonkey
  • 135
  • 2
  • 13
  • We need to see your SQL command : `because I ordered the SQL` – moskito-x Aug 14 '13 at 17:35
  • moskito - thanks for the reply I will update the original post with the SQL Statement – CodeMonkey Aug 14 '13 at 17:52
  • 3
    @CodeMonkey: it seems to me that the problem has nothing to do with the query or the dataset, but with the report. Isn´t any grouping defined on this report? Maybe if you posted the three rows we could have better ideas. – AlexSC Aug 14 '13 at 18:17

1 Answers1

0

I have run into a similar issue using AceReporter. Per @AlexSC, it sounds like the groupings that you have defined in your report are putting two of the records on the same page when the items are ordered. For example if I have a dataset with 3 records:

col1, col2
----------
A, 1
B, 2
A, 3

If my report is grouped on col1, this will show in 3 groups because we go A-B-A. However, if I sort on col1 the rows are A-A-B, so the first too rows are grouped together.

MikeS85
  • 73
  • 6