Get the .trdx location path inside the suctom function dll file

4 posts, 0 answers
  1. Janitha
    Janitha avatar
    5 posts
    Member since:
    Mar 2016

    Posted 29 Mar Link to this post

    I have created a custom function for multilingual support. Inside this function I use path of the language files as an variable. But when I call Directory.GetCurrentDirectory() , System.AppDomain.CurrentDomain.BaseDirectory or other methods to get the report template file location it always returns the path of the 'TelerikReportDesigner.exe' and where the dll file resides (C:\Program Files (x86)\Telerik\Reporting Q1 2016\Report Designer). But my template file resides on another folder(ex:- E:\Reports\..) How can I get the template file location inside the custom function???
  2. Katia
    Admin
    Katia avatar
    300 posts

    Posted 29 Mar Link to this post

    Hello Janitha,

    Relative paths are resolved based on the execution folder of the running application. Test specifying the absolute path to the reports -  E:\Reports\...

    You can also review this stackoverflow thread for information related to this topic.

    Regards,
    Katia
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Janitha
    Janitha avatar
    5 posts
    Member since:
    Mar 2016

    Posted 29 Mar Link to this post

    I cannot specify the absolute path since the path of the .trdx file changes dynamically. I was hoping that there is a way to identify that path as a relative path, not the path of the execution file. 
  5. Katia
    Admin
    Katia avatar
    300 posts

    Posted 01 Apr Link to this post

    Hi Janitha,

    GetCurrentDirectory() method will get the current working directory of the application. You can place the files from E:\Reports\.. location to the drive where the application is running to be able to use the relative path.

    You can also map the relative path to base path that is provided via expression e.g. report parameter:
    //custom function
    public static string GetFullPath(string basePath, string relativePath)
    {
        return basePath+relativePath;
    }
     
    //usage
    "=GetFullPath(Parameters.BasePathParam.Value, '/FileName.ext')";


    The report's BasePathParam  parameter can be updated on displaying the report.

    Regards,
    Katia
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top