Custom DataSource

Hello,

I read the topic on Custom DataSource but I'm not sure Business Object can meet my need.

I am using FS.Net in a stand-alone application with a personnal query builder and a virtual Table filled from MySQL database.
Just a few records are in memory at a time, they are downloaded in small pages that are discarded when no more used.

My virtual Table is not DataTable of course, it looks like Delphi's Custom DataSource with Prior or Next methods.

As I do not know the fields returned by the query (it is the end user who writes the SELECT) how can I use Business Object to link data with report ?

Many thanks for help.

Herve.

Comments

  • edited 6:27AM
    if you have fixed field, query is the answer : SELECT aaa AS field1, bbb AS field2, ccc AS field3
    no problem with fastreport,

    but we are talking dynamic field, i think spreadsheet is the answer

  • edited December 2016
    ipong wrote: »
    if you have fixed field, query is the answer : SELECT aaa AS field1, bbb AS field2, ccc AS field3
    no problem with fastreport,

    but we are talking dynamic field, i think spreadsheet is the answer

    What do you meen by "spredsheet" in this context ?

    Yes, fields are dynamic because the SELECT is writen dynamicly and the database structure may evoluate without recompiling my application.

    Only part of the query result is loaded into memory in a virtual page. When the user skip record and the new record is out of the page, the content of this virtual page is reloaded accordingly. A bit like MySql would do with the "SELECT ... LIMIT index,count" command.

    So I don't use System.Data classes at all but a specific control with specifics methods (First, Last, Next, Prior, Seek, and so on).

    Is it possible to use this system with FS.Net and what is the best way to do it ?

    Many thanks.

    Herve
  • edited December 2016
    Sorry for this empty post (a mistake), but I can't delete it. >
  • edited 6:27AM
    i don't get it....
    1. user creates a query in personal query builder, he/she knows the table structure of mysql database
    2. app reads the result of the query, put into memory/virtual table
    3. fastreport needs .net style memory table, such as business object (class) or datatable
    4. you must convert virtual table to .net style
    5. .net style memory table requirements:
    * field, or maximum field
    * datatypes
    6. therefore, you must set a limit of maximum field, let's say 10 fields and all with 'string datatype'
            public class myVirtualTable
            {
                public string field0 { get; set; }
                ...
                ...
                public string field9 { get; set; }
            }
    

    7. design the layout of the report with myVirtualTable (business object) as datasource
    8. if 10 fields too much, not fit in A4 paper size, use spreadsheet for outputting myVirtualTable
  • edited 6:27AM
    Thank you for your reply.

    Doing so, I lose the benefit of typed fields (DateTime, Double, Boolean, Image).
    I also lose columns's names that will be replaced by properties's names (field0, field1, ...)
    I did the test and it quickly becomes difficult to find a specific column.
    And if the query returns 5 columns, while I have provided 20 properties in the Business Object, the FS.Net TreeView DataSource will display 15 unnecessary fields.

    Is there a way with a CustomDataSource derived from FastReport.Data.CustomDataSource?
  • edited 6:27AM
    in my previous answer :
    1. dot net style as datasource
    2. convert virtual table to dotnet style, for your case, datatable, because it can create columns on the fly, detect datatype for each field in virtual table with typeof operator, typeof(int), typeof(byte), etc
    3. push datatable to fastreport, there is a demo named ReportFromCode, take a look. How to create fastreport without fastreport designer template. You must imagine the layout.
    4. report is limited by paper size

    IMO, fastreport still can give you the solution, but for me, i dont want to loose my hair because of this approach, easy answer, spreadsheet

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.