Kendo Reporting's calling stored procedure multiple times

5 posts, 0 answers
  1. Kamal
    Kamal avatar
    3 posts
    Member since:
    Dec 2016

    Posted 10 Sep 2018 Link to this post

    I am using kendo reporting v 11.x. and MS SQL Server 2016.

    Firstly, I created a stored procedure that returns a list of person.

    Then, I created a simple blank kendo report using visual studio 2017.

    Inside the report, I then created a sqldatasource from the kendo reporting toolbox.

    Lastly, I selected the stored procedure and dragged a table using the toolbox and then I opened data explorer dragged the field names from the data source.

    Please take a look at the attached files. 

    When  click the design tab as shown in the picture my procedure is called multiple times. I verified this by writing an insert query on my procedure. Everytime, I click the design time, I could see the data getting inserted multiple times

    My procedure:

    Alter PROCEDURE SpPersonSel

    AS
    BEGIN

    SET NOCOUNT ON;

    INSERT INTO dbo.Test
        (
            [Name]
        )
        VALUES
        (
            'abc'  -- Name - varchar(50)
        )
       SELECT p.* FROM dbo.Person AS p
    END
    GO

     

  2. Kamal
    Kamal avatar
    3 posts
    Member since:
    Dec 2016

    Posted 10 Sep 2018 in reply to Kamal Link to this post

    I meant the preview tab, not the design tab
  3. Todor
    Admin
    Todor avatar
    520 posts

    Posted 12 Sep 2018 Link to this post

    Hello Kamal,

    Each SqlDataSource query/stored procedure will be executed once per rendering for each data item it is assigned to.

    I suspect that you have assigned the corresponding SqlDataSource to the Report, and to the Table.
    If so, the stored procedure will be called once for the Report. Then, one Detail section will be generated for each data record returned by the Report DataSource (i.e. if the stored procedure returns 5 records there will be 5 Detail sections in the rendered report). As seen from the screenshots, the Table is inside the Detail section, hence the Table will be rendered 5 times. Therefore, the query of the Table DataSource will be called 5 times.
    In the described scenario the same Table should be rendered multiple (5 in the context of my example) times inside the report.
    The issue should disappear upon removing the DataSource of the Report.

    If my assumptions are not correct you can open a support ticket and send us a runnable report (i.e. including backup of the database) for local investigation.

    Regards,
    Todor
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  4. Michelle
    Michelle avatar
    2 posts
    Member since:
    Sep 2018

    Posted 23 Sep 2018 in reply to Kamal Link to this post

    Kamal said:

    I am using kendo reporting v 11.x. and MS SQL Server 2016.

    Firstly, I created a [url=https://www.mybkexperience.onl]mybkexperience[/onl]stored procedure that returns a list of person.

    Then, I created a simple blank kendo report using visual studio 2017.

    Inside the report, I then created a sqldatasource from the kendo reporting toolbox.

    Lastly, I selected the stored procedure and dragged a table using the toolbox and then I opened data explorer dragged the field names from the data source.

    Please take a look at the attached files. 

    When  click the design tab as shown [url=https://www.krogerfeedback.onl]kroger feedback[/url] in the picture my procedure is called multiple times. I verified this by writing an insert query on my procedure. Everytime, I click the design time, I could see the data getting inserted multiple times

    My procedure:

    Alter PROCEDURE SpPersonSel

    AS
    BEGIN

    SET NOCOUNT ON;

    INSERT INTO dbo.Test
        (
            [Name]
        )
        VALUES
        (
            'abc'  -- Name - varchar(50)
        )
       SELECT p.* FROM dbo.Person AS p
    END
    GO

    Did you get any solution for this?

     

  5. Todor
    Admin
    Todor avatar
    520 posts

    Posted 26 Sep 2018 Link to this post

    Hello Michelle,

    If the suggestions from my previous post do not help, you can open a support ticket with additional information about the particular scenario, and send us a runnable report for inspection.

    Regards,
    Todor
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top