>> There's no way AFAIK to fetch N rows but only display N-M rows.
Yes, actually there is <s>.
You do need to give yourself appropriate information from the data source, but this doesn't necessarily mean limiting the rows! (because you might have another data region that shows a different count, in the same report, from the same data).
Here's a reporting query from my favorite ASP.NET add-on table (ELMAH error handler):
Code Snippet
SELECT ErrorId, Application, Host, Type, Source, Message,
[User], StatusCode, TimeUtc,
Sequence, AllXml
FROM ELMAH_Error ORDER BY ErrorId
... now suppose we add a column, as follows:
Code Snippet
SELECT ErrorId, Application, Host, Type, Source, Message,
[User], StatusCode, TimeUtc,
Sequence, AllXml, Row_Number() OVER (ORDER BY ErrorID) AS ItemID
FROM ELMAH_Error ORDER BY ErrorId
(you can add a counter like this different ways in other data sources)
... Now we can add the following filter to a table (or whatever):
Code Snippet
=Fields!ItemID.Value <= 8 ' or whatever maximum you have in mind,
' for example you can say:
=Fields!ItemID.Value <= =Parameters!MyMax.Value
... and readers please note, if you have trouble when you follow these instructions:
When I built this example I had to CInt() (cast) on both sides of the filter expression (including the literal 8!) to get it to work the first couple of times. It may be because I was building the query interactively for the dataset, and the designer doesn't support this clause so, while it processes the SQL, it is not sure about the data type of the result. IAC it does work.
>L<
No comments:
Post a Comment