Separating Reports by Clients or Users

.Net Report Builder supports Multi-tenant Clients, so that you can save and view different reports for different Clients. With version 1.6.2, we also support saving Reports for different users.

Saving separate reports for separate client or user is very simple. You need to provide the Client Id or User Id (or both) in Index.cshtml in the initialization code:

$(document).ready(function () {
   var vm = new reportViewModel({
   runReportUrl: "@Url.Action("Report")",
   reportWizard: $("#modal-reportbuilder"),
   lookupListUrl: "@Url.Action("GetLookupList")",
   apiUrl: "@ConfigurationManager.AppSettings["dotNetReport.apiUrl"]",
   reportId: @(Request.QueryString["reportId"] != null ? Request.QueryString["reportId"] : "0"),
   accountApiToken: "@ConfigurationManager.AppSettings["dotNetReport.accountApiToken"]",
   dataconnectApiToken: "@ConfigurationManager.AppSettings["dotNetReport.dataconnectApiToken"]",
   userId: "", // You can pass your authenticated user id here to track their reports and folders
   clientId: "" // You can pass your multi-tenant client id here to track their reports and folders
 });

Specifying client Id 

DotNet report Builder allows you to add multiple users by creating session ID for each request. The system assumes that you already have an authentication process. your current Client ID is already determined. It is available to use in the current session. Actual authentication or login code is currently not part of .Net Report Builder.

Once client Id is set, the system will automatically save and load reports. Then it will only allow editing/deleting the reports saved for the given client Id. Reports saved with other Client IDs will not be shown.

Specifying user Id

If you want to further control reports just saved for a specific user in addition to the client. If you want to separate reports for a User instead of a Client, populate the user Id field with your currently logged in User ID. Again, we are assuming that your system already has an authentication process. your currently logged in User’s ID is available.

Once you set the user Id, similar to the client Id, the system will save/load reports only for the given user Id, and will only allow editing/deleting reports saved for the given user Id. Reports saved with other User IDs will not be shown.

Just to clarify, you can provide just the client Id, user Id, or both. If you specify both, the reports will be shown for both.

Global Run Only Reports

If you leave the client Id and user Id fields blank, and run the system and create and save Reports, those reports will be treated as global reports and will be available to all clients or users of your system. However, once you specify a client Id or user Id, those users will only be able to see and run the Reports. They will not be able to edit or delete these global reports. In order to edit/delete them, or to create new global reports, you must run without specifying client Id or user Id.

2 Responses to “Separating Reports by Clients or Users

  • Vignesh
    2 years ago

    Hi ,
    How to hide reports based on Client Id.

    • Hi Vingesh, if you provide a different client Id, the reports for only those client Id will show up, and others will be hidden, except for the ones you save without a client Id, as those are considered global reports. Please let us know if this answers your question.

Leave a Reply

Your email address will not be published. Required fields are marked *