Home End User

Restricting End User Calc column functions

edited September 2002 in End User
Using: rb6.03, D6, Custom Report Explorer with dictionary with daAsta.

In Dade I need to restrict certain users from creating/updating a
calculated column of type expression.

That is, specifically I would like them to be able to see existing
ones but not to be able to create or edit them.

What is the recommended method?

Separately I would like to slightly change (in some cases) the sql
string that is produced for a field (TdaField.SQLString I believe).
Is there a way of overriding the method?

Many thanks,
Rick Matthews
Dartek Systems Inc.

Comments

  • edited September 2002
    It shouldn't be too dificult to access the TdaSQL object before the report
    prints to clear the calc fields that the user has added. After the tempalte
    has loaded, extract the SQL object and save a list of the calc fields. Then
    check these in the BeforePRint of the report to make sure these are the only
    calc fields listed. The only problem is that you'll also have to do this
    when they preview the data on the dataview. There is no notification sent
    to the outside world when this happens. You'll have to modify the source to
    send a Delphi event or send an event notification with a TppCommunicator
    object.

    Here is an example of accessing the TdaSQL object in code. Have a look at
    TdaSQL in daSQL.pas for the interface to this class. In this class are all
    the calc field methods and properties you need to alter the calc fields
    defined on this object.

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


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Thanks Jim for the guidance.

    However, if I understand you correctly this will mean that the user
    will be able to create and edit these calc fields as well as use them
    on their report. However at print time they would be removed.

    This, I think, will create support problems and confused users.
    Really I need to stop them from editing the expression field so that
    they know they are not allowed to do it.

    Also, do you have any thoughts on the TdaField.SQLString part of the
    post?

    Many thanks for your very speedy replies.


  • edited September 2002
    Yes, this is possible (I just created a demo that does it). It involves
    creating a custom dataview descendent. This is not a template, but rather a
    replacement of the TdaBDEQueryDataview class. You can unregister the
    TdaBDEQueryDataview class and register this new class you can download:

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


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Thanks very much for the excellent service.

    I will follow you example and try to get specifically what I need.

    Thanks again.

  • edited September 2002
    I forgot to mention, this is just an example of replacing the BDE query
    dataview class. You can follow the same approach for any other plugin that
    you are using, such as DBISAM, Advantage, IBO. Look in your DADE plugin
    unit, and find the query dataview class that is being used. For example, if
    you are using DBISAM, then you would replace the TdaDBISAMQueryDataView
    class with your own descendent.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited September 2002
    Thanks Jim I had noticed that and replaced the Asta
    TdaAstaQueryDataView.

    That works for me, however it doesn't solve my problem. It stops
    access to the Calc button but if you click any other button you get
    the Query Designer Form with all of its tabs.

    What I really want is to allow all users access to the calc tab but
    restrict the calc type of "expression" to specific users (view only
    for some).

    I don't see any way of doing this short of either making a complete
    local copy of daQueryDesigner since the instance of
    TdaQueryDesignerForm is a private of TdaQueryDesigner. Am I missing
    something here?

    Thanks,

  • edited September 2002
    Replace the query designer. The replacement can disable the calc tab. Here
    is an example of replacing the query designer.

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


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.