Repeating pages using a data source input
It is possible to use a question as an input on a Data Source question to allow a user to select how many pages to display on a page repeater at run time. The data source needs to call a SQL Stored Procedure which returns a sequential list of numbers based on a maximum number specified in the question.
The steps to implement this are as follows:
Create and Configure the Stored Procedure
ReturnConsecutiveNumbers stored procedure
create procedure [dbo].[ReturnConsecutiveNumbers]
(
@val int
)
as
begin
SET NOCOUNT ON
SELECT TOP (@val) row_number() over(order by t1.number) as Numbers
FROM master..spt_values t1
CROSS JOIN master..spt_values t2
end
GO
Configure the Data Object
See screenshot below:
Create the question in Designer
Create the number Question
The value captured in the Number question will determine how many pages are displayed by the repeating page control.
See screenshot below:
Create the Data Source Question
See screenshots below :
Create the Repeating Page
See screenshot below:
Updated over 5 years ago