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

segregate user data

edited October 2006 in End User
Hi, we are developing an end user reporting system as we would like our
clients to be able to design their own reports. The problem we are having is
trying to design the system so that each client can only report against
their own data. All client data is stored in the same tables with a db field
that specifies each clients identifier that a particular row belongs to. Has
anyone had a simliar issue and found a way to easily filter each table using
the client identifier when the data is requested from the db. Any tips or
suggestions would be greatly appreciated.

Regards,
Jacques

Comments

  • edited October 2006

    We have had customers implemented this type of functionality before.
    Typically the user will have a user id or some other information that is
    used to to augment the SQL query. The other requirement is that you do not
    want or need the end-user to be be aware that the userid is being used in
    the SQL.

    The solution is to customize the DADE plug-in so that it adds the extra
    information to the SQL text string just before it is submitted to the
    database. For example, if you are using ADO, then modify the
    TdaADOQueryDataView.SQLChanged method (in daADO.pas).

    Here is a simple pseudo code example:

    var
    lsSQLText: String;
    begin

    // get the SQL text string generated by the TdaSQL object
    lsSQLText := SQL.MagicSQLText.Text;

    // modify the SQL text with whatever extra criteria you need


    // assign SQL text to ADOQuery
    FQuery.SQL.Text := lsSQLText; // assign SQL text to ADOQuery

    end;


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.