Adding a table with dynamic rows

  • I have a need to have a table in SSRS based off of a field in the dataset. There is a field (fquantity) that has a numeric value say 50. but the dataset only has 3 records in it. I need to create a table with say 5 columns and 50 rows. Fquantity will change every time. The intent is for someone to record testing data in each of the fields in the table for each item. Thanks

  • SSRS is for reporting existing data, not for data input.

    Are you trying to generate (semi-) blank forms that can be printed for somebody to write in (or, I suppose edit PDF w/ a PDF editor)? That is certainly possible -- you would union the blank rows in your dataset query based on fquantity.

     

  • How do you union the blank rows on fquantity?  I have search and searched and have not found anything.

    Thanks

  • You can use a tally function,  number table, or similar to get a selected  # of rows to generate -- e.g.,

    USE [DBA]
    GO
    DECLARE @fquantity INT = 50
    SELECT NULL AS Col1, NULL AS Col2, NULL AS Col3, NULL AS Col4, NULL AS Col5
    FROM [util].[Tally] (1,@fquantity)

    The union all would come into play if you need to combine returning existing data w/ blank rows. If you need the total of existing rows plus blank rows to equal fquantity (I'm not clear if that's the case or you're only trying to return blank rows), you would need to subtract the # of existing rows from fquantity, and union all the existing rows w/ the generated rows.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply