Search code examples
groupingcrystal-reports-xi

Merging data with a dates table gives strange behaviour when some recordfield is added


I'm using Crystel Reports again after not touching it for about 8 years.

I'm having this situation...

I have 1 data table, and 1 table with just day numbers from 1 to 31. Nothing is really linked between each other.

In my report I let the user select a reference date.

From that date I grab the maximum days of the month.

The report lists a row per day of that month but there are no actual database fields inthere. Just the first 2 letters of the dayname, the day number and another formula based field showing 'yes/no' or '' depending on a main record value.

So far so good.

In the group header I was adding the fields from the main datatable which went all fine until I added fields that in the query on the sql server rely on some cases but CR just read it out as 1 singe record row with everything in it.

For some reason the report generation goes from 1-2 seconds to 30-40 once I add that field that just outputs 'X' or ''. (it represents things assigned to that user)

Other reports where I'm using the same data still generate in 2 seconds.

To get this working right and to eleminate double date records I'm stuck with 3 groups.

I think this ain't optimal and the reason for the slow down although it wasn't there at the start.

So I was wondering:

Should I go for a sub report for the day listing? Can I feed the subreport with my date parameter?

or is there some kind of scripted way to list a row x-times without all the grouping requirements?


Solution

  • Synchro was right, the problem was in the actual query/view.

    For some reason the view takes half a minute longer if you just added an order by to a specific field.

    The "where id between 211 and 265 or id=67" has been moved from a joined view to the actual query.

    Thanks for the hint, Synchro.