Build report with self to choose table

mierlpmierlp Netherlands
edited 2:57PM in FastReport 4.0
Hi,

My application uses about 80 tables. For the user it must be possible to create a report for every table.
I don't want to set 80 frxDataset on a form. What's the best way to build a solution that makes
all 80 tables available into the ReportDesigner. For some report the user needs 2 or 3 tables to show
into a report so he can select what's he needs

Regards

Peter

Comments

  • edited 2:57PM
    Please confirm that I understand everything well.

    1. Do your tables have the same structure - the same column names?
    And you can have the same page layout for all these tables?

    2. Does your report have these column names used in TfrxMemoViews or within any script of event?

    3. What technique do you use for getting data from database - is it TfrxADOQuery or any other kind of query?
    If so attach an example of such a query for any table of those 80.

    Mick
  • gpigpi
    edited 2:57PM
    You may add 3 TfrxDBDataset on your form and set TfrxDBDataset.Dataset what you need before run FR designer or prepare report
    Show all 80 datasets (TfrxDBDataset or TfrxADOTable or TfrxADOQuery) doesn't good idea
  • mierlpmierlp Netherlands
    edited 2:57PM
    Hi Mick

    1. Lots of the tables have the same structure, because the are some kind of ''lookup'' tables, sample tables City, Country,
    see attachment (default_tables.pdf). The page layout can be the same, but the user can defines his own report layout,
    but i can use templates if that helps.


    2. Do not use frxMemoView, it's new for me but if you can explain...any suggestions are welcome

    3. I use MySQL database and DevArt components (Query and Datasource component) for connection to MySQL.
    The query contains for a lot of tables simple select statement like ''Select * from RemainCity order by Name''

    Regards Peter
  • edited 2:57PM
    So your end user has a possibility to use Designer to create his own reports. And the Designer is available from your application.
    Now I see my former idea is no longer valid [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> I thought you had 80 similar tables and one layout to fill with similar data from different tables. One should have a look at what[/img]Gpi suggests. I mean - before end user opens the Designer your application must ask him what tables he will need. And if you (your application) know what tables are neccessary then you will create query components on-fly and add them to the empty Report. So your application must have a kind of a dictionary: table -> select statement.

    PS.
    I'm sure you use TfrxMemoView - this is a basic component you put on a band [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Mick[/img]
  • FRNLFRNL Hoogeveen - Netherlands
    edited 2:57PM
    mierlp wrote: »
    Hi Mick

    1. Lots of the tables have the same structure, because the are some kind of ''lookup'' tables, sample tables City, Country,
    see attachment (default_tables.pdf). The page layout can be the same, but the user can defines his own report layout,
    but i can use templates if that helps.


    2. Do not use frxMemoView, it's new for me but if you can explain...any suggestions are welcome

    3. I use MySQL database and DevArt components (Query and Datasource component) for connection to MySQL.
    The query contains for a lot of tables simple select statement like ''Select * from RemainCity order by Name''

    Regards Peter

    Hello Peter,

    I wonder if Devart has components for database access within FastReport and if not, I woul spend some time in writing components that make it possbile to add data to the report design.

    FastReport supports adding data access, queries and components to the reportlayout in runtime, along with a visual query builder. You can design the whole report when you add end user design to the report.
    I think that is the best way to go.

    I'm not sure where I saw it, but at some point FastReport allowed limiting selection of datasets as well. Or if you would write components, you could add some restriction to the list of tables. Flexibility is enormous.

    I have built these components for Zeos and Accuracer in the past. It is not a very hard thing to do (would cost less time than the suggested workarounds).
    This would also add possibilities for joined queries.

    Building components is commercial activity for me, so I can't help out with code.

    Best regards,
    Teo
    FastReport reseller in de Benelux.
  • mierlpmierlp Netherlands
    edited 2:57PM
    Hi Teo,

    I use the DevArt components for connection to my MySQL database environment and the
    frxDataset are used to connect the DevArt Query components...that's the way i use it.

    Maybe i need to build a solution like GPI suggest in combination with the dictionary like
    Mick.pl suggests.

    I can set within my Query components the displayname for the fields so it's easy
    to understand. When i also set only the fields visible which i want to show within the
    frxDataset then i think it must be possible for that part.

    The trick is when the user needs to create a report based on 2 or 3 tables it must be possible
    to select the needed tables, that can maybe be done the the suggestion from GPI, but the
    problem will be if the user selects the wrong table it must be possible to select a other
    one within the designer and then they must be available.

    I don't think i'm the only one looking for a solution for this ''problem'' because when
    you have a big database application you have lot's of tables.

    Regards Peter



  • edited 2:57PM
    Peter,

    I attach an example of my tests (for FR compiled demo). It is only a half of what you need but you can follow it.
    As I use only FR script so the example could not be in Delphi [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> 1. Dialog shows what your apps can do and what end user can choose 2. After user chooses one of tables/titles/etc you know what queries apply for him 3. Then you can create SQL statement on-fly and name this query My tests show one of the way. But I faced a problem - ADOQuery1.SQL has new contents, some fields can be seen, but the whole Query seems to stay unchanged[/img]> No matter of it - see that MasterData1 has correct number of rows according to a table chosen in a dialog - so it is a proof that right SQL statement was recognized by DataSet,  but not FieldsList[img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> I hope some Gurus over here will help to find the reason why and tell what to do to solve the problem. Mick[/img]
  • edited 2:57PM
    Small suplement: we work with an inherited ADOQuery of our own and almost everyday we do such tricks with succes, but we have some more ADOQuery.methods that FR compiled demo hasn't.

    Mick

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.