Jump to content
We've recently updated our Privacy Statement, available here ×

Printing an element only when the query has finished....help?


saman0suke

Recommended Posts

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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

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.

Carl

Code:
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...