saman0suke Posted January 11, 2011 Share Posted January 11, 2011 Hello, I need to print a horizontal line just when all the records from the main SELECT have been found, is there any way I can do it? thanks!!! Link to comment Share on other sites More sharing options...
cbarlow3 Posted January 11, 2011 Share Posted January 11, 2011 So far I haven't really found a good way to make a conditional print expression that can tell whether or not you've reached the final detail or the final page. Is there any reason you can't just put your horizontal line at the very top of the Summary band? Unless the properties of your main report dictate that the Summary appears on a new page, I would think you could put the line there. Carl Link to comment Share on other sites More sharing options...
saman0suke Posted January 11, 2011 Author Share Posted January 11, 2011 I see, I will give it a try and see how it looks, maybe I'm just trying to use the hard way, thanks!UPDATE: It worked!! thank you, easy method!Post Edited by saman0suke at 01/11/2011 16:47Post Edited by saman0suke at 01/11/2011 17:26 Link to comment Share on other sites More sharing options...
cbarlow3 Posted January 11, 2011 Share Posted January 11, 2011 Unless your query is returning the MAXIMUM row number (a count of rows) with every row or you've defined a List or subreport that essentially duplicates the main query so you can get back a variable that has the total number of rows returned, just returning an incrementing row number as part of your query probably won't help you know while you're in a detail band whether or not you're on the last one.The same topic came up recently where someone wanted to display exactly 10% of the rows that the main query would normally return. How do you set up the FETCH FIRST x ROWS ONLY clause (or similar clause--depends on the flavor of SQL you're using) if you don't know what x should be, right?One solution I came up with was to use a CTE (Common Table Entry) syntax to create one table with my normal data, one table that is just a count of the rows in the normal data, and then a SELECT statement that returns the combination of the two so that every row returns a column that is the TOTAL number of rows being returned. I can output in my detail "1 of 8404", "2 of 8404", etc.An example of how that query might look is pasted below.CarlCode:with fullData as(select Put all your normal select statement here...),singleRow (count) as (select count(*) from fullData)select fullData.someField, fullData.someOtherField, etc., singleRow.countfrom fullData inner join singleRow on singleRow.count>0 Link to comment Share on other sites More sharing options...
cbarlow3 Posted January 11, 2011 Share Posted January 11, 2011 Glad to hear you opted for the Summary band. CTE's, Lists with Subdatasets, and Subreports can all be a performance hit that you can often avoid.Carl Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now