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 clientId 

If you have multiple clients (or companies) using the Report Builder, you can add the current user’s Client ID from the current session in the above code. The system assumes that you already have an authentication process, and your current Client ID is already determined and is available to use in the current session. Actual authentication or login code is currently not part of .Net Report Builder.

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

Specifying userId

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

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

Just to clarify, you can provide just the clientId, just the userId, or both clientId and userId. If you specify both, the reports will be saved/shown for both Client and User.

Global Run Only Reports

If you leave the clientId and userId 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 clientId or userId, 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 clientId or userId.

Was this article helpful to you? Yes 1 No

How can we help?