Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Creating a Report Designer in Code

edited May 2003 in General
I need to know if it possible to create a report designer and all the
associated components in code.

I am currently attempting to create the following components as part of a
class:

fDataDictionary: TppDataDictionary;
fReport: TppReport;
fReportExplorer: TppReportExplorer;
fReportDesigner: TppDesigner;

My plan is to create a class that encapsulates all the needed components for
handling reports. I would prefer to do this all in code; however, I am
running into some problems.

The compiler won't let me assign an ADOConnection object. Assigning to the
fReportDesigner.DataSettings.DatabaseName property appears to require a
string. Should I assign the name of the connection object to the
DatabaseName?

Also, were are TppDatabaseType and TppSQLType delcared. I need to include
the unit where they are declared so I can assign the correct values to the
DataSettings.DatabaseType and DataSettings.SQLType. Thanks.

Comments

  • edited May 2003
    Hi Donovan,

    yes, you can create all needed components in code. There is chapter in the 'Developer's Guide' about that.
    Another way would be creating all components first in visual mode and then using the info from the DFM file to set all needed properties in code.
    Include unit 'ppTypes' in your uses clause.

    regards,
    Chris Ueberall;
  • edited May 2003
    Thanks Chris,

    I was able to get most of it working. The only thing that doesn't appear to be working is assigning the DatabaseName property for the fDataDictionary.DataSettings and the ReportDesigner.DataSettings. The only thing that I was able to get to work is assigning the connection string from my ADOConnection object to the database name. Is that correct? There seems to be a side effect of doing it this way ? that is that when launching a new report and selecting the Data tab and then File ? New, the database login prompt appears. My ADO connection object is set to not display the login prompt, so I am not sure what is happening here. Any thoughts?

    Also, I read the section in the Developer's Guide about creating objects in code, but it only seemed to include reports. Perhaps I didn't read far enough.

    Also, thanks for the suggestion about the DFM files. I will invesitage that as well. Thanks again for the hlelp.

    Donovan
  • edited May 2003
    Donovan,

    Sorry, but my ADO experience is somewhat low, there should be a way to assign the connection component to prevent the login prompt.

    regards,
    Chris Ueberall;
  • edited May 2003
    Correct, the ADOConnection object has a login prompt property. The problem
    was that I couldn't get the report stuff to see my Connection object.
    Apparantly, the connection object must be a component on the form.

    Once I put the ADOCon object on the form instead of creating one myself, the
    report stuff allowed me to assigned the DatabaseName as the name of the
    connection object instead of the connection string. Seems kind of a strange
    way to work, but oh well. Thanks for the help.


    Donovan


  • edited May 2003

    Donovan,

    Try using 'self' as the owner when you create your connection at runtime.

    -Jack
  • edited May 2003
    Jack is on the right path. RB tries to establish this connection by looking
    in the Screen.Forms and Screen.Datamodules to find this ADOConnection object
    when the dataview is streamed up from the template. If it isn't
    owned/parented by a form or datamodule in the application, then RB will
    never find it. When no ADOConnection is found, a default one is created and
    used by RB. You have to enter the login prompt as this is the default state
    of the ADOConnection when we create it.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited May 2003
    That makes sense. Thanks for the help. Now that we are using your tools
    correctly, I must say that I am really impressed with your reporting engine.
    It's very nice.


    Donovan


This discussion has been closed.