How to set default folder when user clicks File in Webdesigner

Posted by: mrisher on 31 August 2021, 8:06 am EST

    • Post Options:
    • Link

    Posted 31 August 2021, 8:06 am EST

    We are using MS MVC on the backend and JSViewer on the client side. Is there a way to set the default folder that the user can pull reports from?

    Requirement:

    Each user will log in with a company name and an employeeID. The file structure must look the same.

    In the resources folder I have that set up. Ex. resources\Company\Employee1002. In this folder are a bunch of rdlx files with preset datasets. When the user clicks File in the client side Webdesigner, this needs to be the default folder they see/save to. I thought I saw a ReportsFolder property on the JSViewer, but I cannot get this to work.

  • Posted 3 September 2021, 3:11 pm EST

    To set the default folder to see reports from/save to, you need to use the following lines of code in Startup.cs > Configure method :

    
    app.UseReporting(config => config.UseFileStore(ResourcesRootDirectory));
    app.UseDesigner(config => config.UseFileStore(ResourcesRootDirectory, false));
    
    

    The ‘ResourcesRootDirectory’ would be something like:

    private static readonly DirectoryInfo ResourcesRootDirectory = 
    			new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "resources" + Path.DirectorySeparatorChar));
    

    Refer to the following github link for a complete sample:

    https://github.com/activereports/WebSamples15/tree/main/WebDesignerSamples/WebDesigner_MVC_Core

  • Posted 7 September 2021, 9:32 am EST

    The problem is, this is only set up for a single-user for the entire application and, since it is done in the start up of the application, the user information isn’t available yet. This answer does not answer my question. Each user needs to have his own folder to store reports in. You are dumping all of the files into one folder. I have folders set up in the resources folder for each user. When they click on File in the designer, it defaults to resources, not the user folder inside resources. How do I set it so the user folder is open by default when File is clicked?

  • Posted 8 September 2021, 2:31 pm EST

    This is related more to ASP.NET core than ActiveReports. I think what you need to achieve your requirement is to use conditional middleware, something like :

    app.UseWhen(context => context.Request.Query["user"] == "xyz", appBuilder =>
    			{
    				app.UseReporting(config => config.UseFileStore(ResourcesRootDirectory));
    			});
    

    You can add your condition to check the logged in user and set the folder path accordingly. Please refer the following page for more details on this - https://www.devtrends.co.uk/blog/conditional-middleware-based-on-request-in-asp.net-core

    Scroll down to the section ‘Conditional middleware with UseWhen’.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels