Mock Data / DataSource

2 posts, 0 answers
  1. Jakob
    Jakob avatar
    1 posts
    Member since:
    Apr 2017

    Posted 14 Jul Link to this post

    Hi everyone!

    We are using the reporting designer to create report templates (trdp) which are then parsed and rendered as pdf from an application.
    What we were looking for is something like create parameters (works perfectly!) for datasource(s). Parameters can be added as many as needed with some options and default values - great! But for a datasource it is only possible to use something "real" or no data source at all (=no preview feature). A "mock" datasource or better something like a "Schema definition" used by tables for example would very awesome.

    Consider the following requirement:
    A report for an invoice should be designed. Now the basic fields like number, date, issuer, ... no problem, just create parameters, fill in some values and preview works perfectly. Later in code just replace the values of the parameters with real values.
    Now there is also a "Table" for the invoice line items. When adding a data source (for example SQL) another person must have the same database or the database must allow remote access to get a report preview. Also the database/table for the data must exist or be designed before the report can be created.

    Is it possible to get some data/data source for preview (like define a schema same as parameters (field names + type)) and fill in some dummy values.
    When rendering using the application just set the DataSource property of the report with some Bussiness Object (like a list of objects with those fields and types) and those are rendered then instead.

    Why?
    Its very hard to create a report without having access to data or a database or event when the data design is not final yet. May the report designer needs an additional field, which is not available yet, the database must be updated first to continue or the business object (Assembly) must be changed, compiled and shared before the report can be finished. I don't think is is very "standalone" this is more like "report designer + assembly or sql sharing"

    Is there something i am missing or planned for the future to use table components without the requirement of an "Assembly" with the business objects or an working SQL Connection? Just like whats an template in my opinion is: Define what is needed, and later "fill" or "provide" whats required/defined by the template - no matter how and where it is received or comming from?

    Currently i am using a CSV data source with inline CSV (to define schema and demo values for preview and autocompletion of fields).
    In code we are setting the data source to an business object, and the data source is replaced. This is very near of what we are looking for but isn't there a "nicer" way?

    Thanks in advance!

  2. Todor
    Admin
    Todor avatar
    171 posts

    Posted 18 Jul Link to this post

    Hello Jakob,

    We provide the option of setting the SqlDataSource connection string as Named connection string. The real connection string will be taken from the configuration file of the application - for Standalone designer this is Telerik.ReportDesigner.exe.config. This way it is possible to use different databases to feed the same report without modifying the report - it is necessary only to change the real connection string that corresponds to the named one in the user application/Standalone designer. Check the Connecting the SqlDataSource component to a Data Source article for more information.

    Concerning the ObjectDataSource, in the report definition it is necessary to set the DataSource and DataMember properties as strings. They correspond to the type of Business object, and its method to be used to get the data. In run time and design time they are resolved using reflection. Hence, you can have dummy data in a Business object with the same name as the real one, and use it for design purposes. To use the real data it will be necessary to replace the dummy assembly with the real one - if both have identical names and GetMember method signatures it will *not* be necessary to modify report definition.

    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