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

Disallowing deletion of reports (or modifying of names)

edited September 2003 in End User
Hi,

I am trying to prevent users from deleting or renaming certain reports. For
example, a report that begins with 'std' cannot have its name changed. So,
on the tblItemBeforePost method I check for this and then Abort if need be.
When this happens though, the Explorer page goes blank, and there is nothing
you can then do. Similarly, if a report is deleted, for some reason it
triggers the tblItemBeforePost method first, and gets stuck there. I
imagine the Abort function will also cause problems in the
tblItemBeforeDelete method.

So what is the best way to prevent modifying of names and/or deletion of
reports?

Thanks

Alex

Comments

  • edited September 2003
    Hi Alex,

    The best way is to implement read-only on the items. Here is an example:

    http://www.digital-metaphors.com/tips/ReportExplorerWithReadOnly.zip


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited September 2003
    Hi Jim,

    Thanks for the example. Just quickly, is this the only way to do it? I
    have to modify my own Explorer form?

    Regards

    Alex

  • edited September 2003
    Also, the example, that caters for any changes via the Report Explorer, but
    then wouldn't I have to also modify the report editor to prevent saving a
    report with a prefix of 'std'. A solution at the dataset would be much more
    elegant, but seems to cause issues when aborting.

    Regards

    Alex

  • edited September 2003
    Hi Alex,

    You can hide the save menu options in the designer as shown in this example:
    http://www.digital-metaphors.com/tips/HideDesignerSaveMenu.zip

    If you want to control where the report is going to be saved then you can
    control the report saving process by using the Designer.OnCustomSaveDoc
    event.

    If you want to simply change the name of the report when it is saved, then
    you'll have to use the Report.Template.OnSaveStart event to setup the
    Report.Template.DatabaseSettings.Name so that when the report is saved, it
    will be saved under this new name in the same folder in the report explorer.

    procedure TmyEndUserSolution.SaveStartEvent(Sender: TObject);
    begin
    ppReport1.Template.DatabaseSettings.Name := 'howdy partner';
    end; {procedure, LoadEndEvent}

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.