Report parameters

5 posts, 0 answers
  1. Maxime
    Maxime avatar
    30 posts
    Member since:
    May 2006

    Posted 12 Nov 2007 Link to this post

    Hi,

    1/ I tried to use the ReportParameters collection to pass paramaters to my report but I don't understand when the databinding occurs. I'seem to be directly after the report was created.

    I saw on forum's samples that you combine report parameters with the Filters collection to filter results. But I already have a function of my Bussiness Layer that can take two date parameters to reduce data.

    So I wan't to pass dates to the report and populating it with my function who take the two dates in parameters. How I can do that? At which place I must define the datasource property? Why isn't there a method Databind?

    I tried to use the NeedDataSource event but I don't understand when it is fire.

    2/ If the is no data to show, how I can replace the report struct by a simple message text ?

     Thanks for yours reponses.

  2. Maxime
    Maxime avatar
    30 posts
    Member since:
    May 2006

    Posted 14 Nov 2007 Link to this post

    Hi,

    Please, can somebody help me ?

    Best regards,
  3. sami
    sami avatar
    13 posts
    Member since:
    Aug 2007

    Posted 14 Nov 2007 Link to this post

    hey Sébastien,
    Before you initiate Report check if Data is present or not , 

    sql="select * from emp"
    if (ds!=null)
    {
        ExportToPDF(reportnam, myinvoiceable);
    }
    else  "give your message"

    check this and see where this will print your message.
  4. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 14 Nov 2007 Link to this post

    Hi Sébastien FLEURIET,

    For your convenience we attached a project showing some aspects of Report databinding.

    For demonstration purposes we created sample business object as a datasource.

    If you do not have parameters the simplest way to bind the report is in design time to set DataSource.
    In case you have parameters there are two approaches. One is to use NeddDataSource report event and in the handler you can use parameters to filter data and assign the result to the Telerik.Reporting.Processing.Report.DataSource property.
    This technique can be read in our documentation Using Report Events. In the supplied code you can find the similar implementation but it is commented (not used).

    Because values for the parameters can be provided by the user of the report we demonstrate how to filter the data and update Report definition. All this logic is implemented in the ReportViewer form. The Viewer is responsible to start the processing of the report by invoking RefreshReport().

    Our reporting engine use the definition and DataSource to bind data to the report items, layout them and render the result to the output. In short, you can view that we does not use report parameters, because data are filtered outside the report.

    In the same project we also show how to implement message showing "No Data" if the filter does not return any data.

    I hope this information helps. Thank you.

    Regards,
    Hrisi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Maxime
    Maxime avatar
    30 posts
    Member since:
    May 2006

    Posted 14 Nov 2007 Link to this post

    Thank you Hrisi,

    I will look at that and I will test your sample project.

    Best regards,
Back to Top