Home DADE

Curstom DataView

edited October 2004 in DADE
I now try every source you provide, but i can't find a way for my problem.
In our application we provide a dialog, where the user can preset some
properties. Before starting the report, the new query with the parameters is
build, the Query is opend and the results is given to the report
(DataPipeline).

The problem is, that the user can only use the fields i provide him, so i
need to change the main statement. I now want to push my own statement into
"Data" Tab from report builder, but there is now way. So i try out some
examples you provide, also CreateDataModCustOrderLinkedDataViews.zip from
your side. But that example only works with BDE, i need ADO. Maybe you can
send me an example or some hints for about what is todo.

For example (from CreateDataModCustOrderLinkedDataViews.zip):
- What must i set for "DataBaseName"?

I like the ReportBuilder, but that way is very difficult so you maybe should
change this in next releases.

Greetings,
Sven Schmidts

Comments

  • edited October 2004

    There are two options:

    1. You can write code to extract the TdaSQL object from the DataView and
    modify it.

    www.digital-metaphors.com/tips/ExtractSQLObject.zip

    The next release will contain a simpler runtime interface for modifying the
    SQL dynamically. :)


    2. Create your own custom dataviews. We only examples for the BDE, but they
    can be copied to support ADO. Some of the code you will need to copy is
    located in daDBBDE.pas - it contains the ancestor classes to the classes
    that are created by the dataviews.





    --


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    Nard,

    thanks for your answer, but that doesn't solve my problem.

    they

    that's the point, there is nothing to read, no documentation in the web. I
    take a look into daDBBDE and understand ... nothing. The Helpfiles are
    silent if i ask for that topic. What exactly must i change into daDBBDE for
    working with ADO? Or can i use that class, setting some properties to other
    values? If yes, what values to what properties? I don't know what is todo,
    so maybe it's a good idea to put them into FAQ, because many other users
    (Newsgroup) have the same problems. Please give a little hint :)

    Regards,
    Sven Schmidts
  • edited October 2004

    For an overview of the DataView architecture, please see the DADE thread of
    the Tech Tips newsgroup. Beyond that we have the demos which contain
    commented code. For the next release we are adding improved support for
    dynamically modify the report SQL via Delphi and RAP code.

    I went back and read your original post. You mentioned an example called
    CreateDataModCustOrderLinkedDataViews.zip but said you need an ADO version
    of it. I was able to find an version of that example that you can download.

    www.digital-metaphors.com/tips/DataModCustOrderLinkedDataViewsADO.zip

    The above example is one approach to implementing a solution such as you
    describe.

    The other is to creat the custom dataview templates as shown in the custom
    dataview examples. The example as you have noted rely upon some ancestor
    classes defined in daDBBDE.pas. The unit daDBBDE.pas contains two class
    definitions that are relevant:

    TdaBDETemplateDataView = class(TdaQueryDataView)
    TdaBDEQueryTemplateDataView = class(TdaBDETemplateDataView)

    These classes add some helper methods that are used by descendant classes
    (like those in the custom dataview examples). To adapt to ADO you need to
    copy those two classes to a new unit and rename them like this:

    TmyADOTemplateDataView = class(TdaQueryDataView)
    TmyADOQueryTemplateDataView = class(TmyADOTemplateDataView)

    You then need to modify the classes from BDE to ADO by replacing the BDE
    based components with ADO counterparts. TADOQuery will replace TQuery and
    TADOConnection will replace TDatabase, etc.




    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    > I went back and read your original post. You mentioned an example called
    download.

    "The page cannot be found" :(
  • edited October 2004
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2004
    Hi Nico,

    we are on the right way :) You create master/detail "on demand", that's
    correct. The problem in your example is, that the report based on real
    existing, non filtered tables from server. In your example every (!) record
    from customers is used, but that's not exactly what i need. Say: the user
    can select, wich customers should be print. For example, he defined "select
    * from Customers where Name like 'test%'". Then the report must be based on
    this dynamically statement (TAdoQuery) instead of the real server tables. In
    my example the user have a new sheet in "Data" Tabsheet, where only the
    result of the Statement above is used (test%). This table can be used to
    create Master/Detail relations, so only orders is print, where the
    customername is like test%.

    Regards,
    Sven Schmidts


    http://www.digital-metaphors.com/tips/CreateDataModCustOrderLinkedDataViewsADO.zip
  • edited October 2004

    I updated the example to include autosearch criteria on CompanyName. Try
    downloading again.

    I also found an error. For each dataview the SQL.DataBaseType and SQLType
    property values were incorrect.


    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    Nard,

    thats works, thanks. But please tell me: I have an self-build query ("select
    id, name, country from View.... where ...") with many fields for data-view;
    that doesnt work with your example, because it based on real tables. Why
    it's so difficult to show this self-build query into datasheet? Without this
    i can't use data-sheet, because every record is printed and not only the
    selected. Is there an (free) update where this works? We use registered RB
    Enterprise 7.04 since 2 month.

    The problem is that i need to build a form for every kind of record, because
    i must preselect the records (in tform) and the user can use the fields from
    this preselction into the builder (design-tab). We have many reports, so i
    need to build a form for every kind. If that above works, i only put the
    result-query into datasheet and the user can build master-details as he
    want, thats more easier for me.

    Best Regards,
    Sven Schmidts
  • edited October 2004

    Sorry, I do not understand the question.

    What is wrong with the solution that we provided? You asked how to build and
    link queries and we provided a solution. You then asked how to apply search
    criteria and we modified the example to do that.

    Are you asking how to build a query against a database View rather than a
    database Table? Internally the ReportBuilder ADO plug-in is calling
    TADOConnection.GetTableNames to get a list of the tables supported by the
    database (See daADO.pas, the method TdaADOSession.GetTableNames). I think
    the TADOConnection.GetTableNames returns the views. If it does not, then you
    can augment the TdaADOSession.GetTableNames with the code necessary to do
    so.

    What do you mean by data-sheet?

    What do you mean by every record is printed? If you apply search criteria to
    the SQL then only the records that meet the criteria will be returned to the
    dataset. The report will be definition traverse the datapipeline to which it
    is connected and generate a detail band for each row in the dataset.



    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    Nard,

    first thanks for your very fast and good support. I understand the problem
    from Data-Tab: The tables based on real existing ADO-Tables. If i put, for
    example, "Customers" and "Cars" on the form and create "Master/Detail"
    between booth tables, all works fine. But the report prints every data
    coming from the database, without any filtering. What i need is to show my
    own virtual table in data-tab, for example "myCustomers" to mix this virtual
    tables with real tables.

    If that works, the user can select the values he need in my selection-form,
    the program dynamically build the statement (select from ... where ... and
    ... and ...). Then he can change to data tab, see my virtual tab where my
    fields displayed. He add real existing tables and build master/detail based
    on my selection and the real (myCustomer <> Cars), not on every record from
    server. I cant use your example ("like") because there many different
    records selected after my selection-form. Thats my problem.

    Best regards,
    Sven Schmidts
  • edited October 2004

    The TdaSQL object can be used to construct most types of search conditions,
    it in no way limited to use Like as the search operator. You can use the
    TdaSQL object to define the types of SQL that the Query tools support. Try
    using the Query Designer to construct queries that have search conditions
    using any of the standard SQL operators. (The examples are just that -
    simple examples, they is not way an example can demonstrate the entire
    spectrum of functionality.)

    Many database products allow Views to be defined - I assume this is what you
    mean by virtual table and you should be able to use these via ADO as I
    discussed before.





    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.