Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 612
  • Last Modified:

SSRS Create Blank Numbered Grid

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
wfwalshiii
Asked:
wfwalshiii
  • 2
1 Solution
 
Nico BontenbalCommented:
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
 
wfwalshiiiAuthor Commented:
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
 
Nico BontenbalCommented:
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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now