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

ItemOptions

edited November 2003 in End User
I created a end-user environment wich filters pre-defined (by the developer)
reports and End-user-designed reports, the app uses tha same ppExplorer
component for both of them, but when the predefined reports are displayed I
empty the ItemOptions :=[] and the explorer is se to Preview instead of
design, so the user can't create, delete or modify them.

But when you switch to predefined and then back to end user the New... menu
item in the designer dissapears. What am I missing to restore full options?

Thanks in advance

Eduardo Martinez

Comments

  • edited November 2003
    "Eduardo Martinez" escribi? en el mensaje
  • edited November 2003

    I tried a simple test in which I placed two radio buttons (rbDesign and
    rbBrowse). I added a button to configure the explorer item options and
    launch the exploer. See code below. In my testing this code worked as
    expected. In Browse mode I could only preview reports, in Design mode I
    could create new reports. The menu items of the report explorer were updated
    to reflect this. Note that I closed the explorer prior to changing the
    values. The report explorer does not support changing the options without
    closing the expplorer form.


    procedure TmyEndUserSolution.btnLaunchClick(Sender: TObject);
    var
    lsMessage: String;
    begin

    if rbDesign.Checked then
    begin
    ppReportExplorer1.ItemAction := iaOpenToDesign;
    ppReportExplorer1.ItemOptions := [ioAllowDesign, ioAllowNew,
    ioAllowDelete, ioAllowRename, ioAllowMove];
    end
    else
    begin
    ppReportExplorer1.ItemAction := iaOpenToPreview;
    ppReportExplorer1.ItemOptions := [];
    end;


    if not(ppReportExplorer1.Execute) then
    begin
    lsMessage := 'Error: ' + ppReportExplorer1.ErrorMessage;

    MessageDlg(lsMessage, mtError, [mbOK], 0);
    end;

    end;


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    Thanks a lot

    what I did is set two buttons, one for the preview and other for design,
    here it is the code, the explorer is modal so you can't open two explorers

    procedure TFrm_Principal.SpeedButton1Click(Sender: TObject);
    begin
    with DM_Reportes do begin
    Qry_Folder.SQL.Clear;
    Qry_Folder.SQL.Add('select * from rb_folder where usuario = ''ADMIN''');
    Qry_Folder.Open;
    Qry_Items.SQL.Clear;
    Qry_Items.SQL.Add('select * from rb_item where usuario = ''ADMIN''');
    Qry_Items.Open;
    ppReportExplorer1.ItemAction := iaOpenToPreview;
    ppReportExplorer1.FolderOptions := [];
    ppReportExplorer1.ItemOptions := [];
    ppReportExplorer1.Execute;
    end;
    end;

    procedure TFrm_Principal.SpeedButton2Click(Sender: TObject);
    begin
    with DM_Reportes do begin
    Qry_Folder.SQL.Clear;
    Qry_Folder.SQL.Add('select * from rb_folder where usuario = ''PUBLICO''');
    Qry_Folderusuario.DefaultExpression := 'PUBLICO';
    Qry_Items.SQL.Clear;
    Qry_Items.SQL.Add('select * from rb_item where usuario = ''PUBLICO''');
    Qry_Itemsusuario.DefaultExpression := 'PUBLICO';
    Qry_Folder.Open;
    Qry_Items.Open;
    ppReportExplorer1.FolderOptions :=
    [foAllowNew,foAllowDelete,foAllowRename,foAllowMove];
    ppReportExplorer1.ItemOptions :=
    [ioAllowDesign,ioAllowNew,ioAllowDelete,ioAllowRename,ioAllowMove];
    ppReportExplorer1.ItemAction := iaOpenToDesign;
    ppReportExplorer1.Execute;
    end;

    Now if I run the app and open the allow-design explorer first, everything
    works fine from there on, but if I open the just-preview explorer first,
    close it and then open the allow-design I loss the "File->New... Cntl+N" and
    the "File->New report" menu items in the Design tab.The menu "File" begins
    with "Open... Ctrl+0"

    just as a note the OnClose event of the explorer closes the datasets.
    "usuario" is a field I created to filter reports in the same table for
    different kind of users.

    Best regards

    Eduardo Martinez

  • edited November 2003

    Sorry, I was looking at the ReportExplore menu items, not the
    ReportDesigner.

    I traced the ReportExplorer source code and you need to set
    ReportExplorer.Initialized to False prior to calling Execute:

    {configure options}
    ppReportExplorer1.Initialized := False;
    ppReportExplorer1.Execute;



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    That was it, problem fixed

    Thanks a lot

    Eduardo Martinez


This discussion has been closed.