This is a migrated thread and some comments may be shown as answers.

Fixed number of row in a table

1 Answer 377 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Gabriele
Top achievements
Rank 1
Gabriele asked on 27 Apr 2012, 11:21 AM
Hi,

is there a way to have a fixed number of row in a table even if the datasource have only one rows?

I have an invoice report and the details must have a fixed number of row (10 in this case). If the datasource returns only 2 rows, the other 8 will be blank. In SQL Server reporting service, I achieve it by this query:
DECLARE @Empty TABLE(ROW_NUM INT);
DECLARE @iCount INT
SET @iCount = 1
 
WHILE @iCount<=10
    BEGIN
        INSERT INTO @Empty VALUES(@iCount)
        SET @iCount = @iCount + 1
    END
 
SELECT DETTAGLI.*
    FROM @Empty RF
    LEFT OUTER JOIN (
                    SELECT
                                    ROW_NUMBER() OVER (ORDER BY SEQ) AS RIGA,
                                    FD.SEQ,
                                    UM.CODICE AS UM,
                                    FD.PREZZO,
                                    FD.QUANTITA,
                                    FD.IMPORTO,
                                    FD.DESCRIZIONE,
                                    I.DESCRIZIONE AS DESC_IVA,
                                    I.ALIQUOTA,
                                    I.CODICE AS CODICE_IVA
                                FROM vend.T_FATTURE_DETTAGLIO FD
                                INNER JOIN cont.T_ALIQUOTE_IVA I ON I.ID_ALIQUOTA = FD.ALIQUOTA_IVA_ID
                                INNER JOIN magaz.T_ARTICOLI ART ON ART.ID_ARTICOLO = FD.ARTICOLO_ID
                                LEFT OUTER JOIN anag.T_UM UM ON UM.ID_UM = ART.UM_ID
                                WHERE FATTURA_ID = @prmIDFattura
                    ) DETTAGLI ON DETTAGLI.RIGA = RF.ROW_NUM

But in Telerik Reporting it is not possibel to declare variables into Query. It is an alternate way?

Thanks

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 27 Apr 2012, 12:18 PM
Hi Gabriele,

Clearly there is no such functionality out of the box. If you want to have empty rows you should manipulate the your data so it has rows with default values (null or ""). The SqlDataSource Component is only a wrapper and its purpose is only to specify the means how to obtain data  (e.g. in the case of SqlDataSource - by executing a SQL query against a database). It does not contain any data or work with it, so in short Telerik Reporting is not aware of your data, neither does it care what it is, as long as it is supported (see Data Source Components). We would appreciate if you explain what did you try to reach the conclusion that it is not possible to modify your database query in any way.

Regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Gabriele
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or