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

ReportExplorer - DataSettings Dialog

edited January 2002 in General
Hello all,

I am trying to use custom Report Explorer. I've added buttons (on the
toolbar of the RepExplorer) which displays query wizard.

I want to use button which will display data settings dialog (available from
data panel and file menu of the report designer). I cannot get it to work
properly, somehow I get access violation and other error messages. Can
anyone help here.

Many Thanks.

Mirza

Comments

  • edited January 2002
    The code we use to display the dialog is below.


    {---------------------------------------------------------------------------
    ---}
    { TdaDataManager.DisplayDataSettingsDialog }

    procedure TdaDataManager.DisplayDataSettingsDialog;
    var
    lDataSettingsDlg: TppCustomDataSettingsDialog;
    lFormClass: TFormClass;
    begin

    if (FDataModule = nil) then Exit;

    lFormClass := ppGetFormClass(TppCustomDataSettingsDialog);

    lDataSettingsDlg :=
    TppCustomDataSettingsDialog(lFormClass.Create(Application));
    lDataSettingsDlg.DataModule := FDataModule;
    lDataSettingsDlg.LanguageIndex := FCurrentReport.LanguageIndex;
    lDataSettingsDlg.DataSettings := FWizardManager.DataSettings;

    lDataSettingsDlg.ShowModal;

    lDataSettingsDlg.Free;

    end; {procedure, DisplayDataSettingsDialog}


    You'll need to assign the datamodule of the current report, which can be
    found by calling

    uses daDataModule;

    procedure DoIt;
    var
    lDataModule: TdaDataModule;
    begin
    ...
    lDataModule := daGetDataModule(ppReport1);
    ...
    lDataSettingsDialog.Datamodule := lDataModule;
    ...
    ..
    .

    You'll then have to set the Datasettings object from the report designer
    object, to the lDataSettingsDlg.Datasettings.



    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002
    Thank you for this reply.

    However, I did try to follow the code that you suggested, but when dialog is
    active there is nothing in combo - boxes. When clicked OK access violation
    error message displays.

    This is the code that I am using:

    {-------------------------------------------------------------------------}
    uses daDatMan, daDataModule, ppForms, daDataSettingDlg, ppDsgnDB;

    var
    lDataModule: TdaDataModule;
    lDataSettingsDlg: TppCustomDataSettingsDialog;
    lFormClass: TFormClass;
    begin
    lDataModule := daGetDataModule(ppReport1);
    if (lDataModule=nil) then Exit;

    lFormClass := ppGetFormClass(TppCustomDataSettingsDialog);


    lDataSettingsDlg:=TppCustomDataSettingsDialog(lFormClass.Create(Application)
    );
    lDataSettingsDlg.DataModule := lDataModule;
    lDataSettingsDlg.LanguageIndex := ppReport1.LanguageIndex;

    lDataSettingsDlg.ShowModal;
    lDataSettingsDlg.Free;
    end;
    {-------------------------------------------------------------------------}

    I am out of the ideas, so please help.

    Cheers,
    Mirza

  • edited January 2002
    I made a simple demo which shows the data settings dialog, then launches the
    report designer. When you create a new dataview in a report, it should use
    the datasettings as they were configured in the datasettings dialog.
    http://www.digital-metaphors.com/tips/ShowDataSettingsDlg.zip

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.