Solved

SSRS Create Blank Numbered Grid

Posted on 2014-03-31
3
573 Views
Last Modified: 2014-04-01
I am try to create a form that will be printed from an SSRS Report. I would like to create a subreport to embed in the main report.

This subreport should print some column headings then a blank numbered grid:

Something like this:

    Col 1   |   Col 2  |   Col   3 |   Col 4
--------------------------------------------------
#1           |             |               |
#2           |             |               |
#3           |             |               |

Open in new window


I would like to send the subreport the number of rows to create - as a parameter.

Thank you in advance for your help!
0
Comment
Question by:wfwalshiii
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
Nico Bontenbal earned 500 total points
ID: 39968960
You could try with this SQL statement as the data source for the Grid:
;With Rows(Id) as
	(
		select 1 
		union all
		select id + 1 from rows where id < 42)
	select * from Rows
	OPTION (MAXRECURSION 42);

Open in new window

See http://technet.microsoft.com/en-us/library/ms186243(v=sql.105).aspx for more information about this technique. You can replace 42 with @GridRows (for example) to make it a parameter.
0
 

Author Comment

by:wfwalshiii
ID: 39970219
That works for what I asked. Thank you.

If I wanted to do this with the same idea, can I force SSRS to jump to next record mid-row?

    Col 1   |   Col 2  |   Col   3 |   Col 4
--------------------------------------------------
#1           |             | #2            |
#3           |             | #4            |
#5           |             | #6            |

Open in new window

0
 
LVL 22

Expert Comment

by:Nico Bontenbal
ID: 39970333
You could add a column grouping to your matrix and create a formula that returns true for even numbers and false for odd numbers, then group on that formula.
Another option is to change your code to:
;With Rows(Id) as
	(
		select 1 
		union all
		select id + 2 from rows where id < 42-1)
	select * from Rows
	OPTION (MAXRECURSION 42);

Open in new window

This will return the numbers for Col1 for you. On Col 3 you just add 1 to that number.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Filtered index 5 56
Best Query To Insert One Year Calendar 6 45
T SQL Update Table from another table 5 45
Using CTE to insert records into a table 2 29
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now