Chapter 6. File System

6. File System

The ReportServer File system meets a variety of functions. First, it serves to file various files and resources so as to use them, for instance, as a basis for datasources (e.g. CSV files), or as resources for reports (e.g. images). In addition, a major part of ReportServer settings (e.g. the mail server configuration) can be performed with configuration files that you will find in the file system's sub-directory etc. Furthermore, so-called ReportServer scripts can be filed in the file system that cover a great number of varying cases of use. These scripts can serve as a basis for datasources (script datasources) or for reports (script reports). They can, however, also provide additional functionality, or be used to perform maintenance tasks.

The file system has a hierarchical structure, just like file systems of common operating systems. You will find the file system in the Administration module under File system. The following object types can be created in the File system tree:

Folder: Serve to structure files
File: Any file (e.g. image, text file, CSV, etc.)

Both objects share the usual attributes name and description. In addition, folders can be configured for web access. This means that objects in these folders (including subfolders) can be accessed by URL without prior authentication (i.e., permissions are not checked for accessing these objects).

After having selected a folder, in the right window above the Apply button you will find the area marked Drop files here. Here you can quickly copy files from your local file system to the ReportServer File system. Drag files, for instance, from your Windows Explorer or Mac OS Finder to the marked area. As soon as the files have been uploaded they will be dis- played in the file tree.

If you create files in the file tree by using the context menu (right click on a folder), or you select already existing files, you can enter a name and description as well as the Mime-type for the file. Additionally, you will be given the current file size as well as a download link. By means of a form, you can upload a new file to the server and update the currently stored file. Text files can directly be edited in ReportServer. In the tree, click on the text file and then select the tab Edit file (next to Properties).

6.1. Configuration Files

ReportServer configuration files are located in the etc directory, following the Unix operating system structure. Configuration files are in XML format and are marked with the file extension .cf by default. A configuration file could be as follows:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<report> 
		<id>41390</id>
	</report>
</configuration>

For further information on the individual configuration options refer to the ReportServer configuration guide.

6.2. Filing of Scripts

By default ReportServer scripts are filed in the bin directory (this location can be changed; for further information see the ReportServer configuration guide) with the file extension .rs or .groovy. ReportServer scripts are written in the language Groovy (https://groovy-lang.org/). They are a powerful tool to enhance ReportServer, to perform administrative tasks, or to generate complex reports. Please observe that a user requires the Execute right to run scripts. The explanation of ReportServer scripts in more detail would go beyond the scope of this manual. You will find a brief introduction in Chapter 21. ReportServer Scripting. For a detailed introduction to ReportServer scripts we refer to the separate scripting guide.

6.3. Rendering Graphviz DOT files

You can render Graphviz DOT files as SVG graphs directly in the RS file system if your DOT file contains the content type ''text/vnd.graphviz''. Note that this is necessary for being able to convert the DOT to SVG.

Note that if the file's content type is not set to ''text/vnd.graphviz'', you won't see the preview tab or preview buttons.

You can find more information on Graphviz DOT in ReportServer in Section 14.

6.4. Rendering Markdown files

You can render Markdown (.md) files as HTML directly in the ReportServer file system if your Markdown contains the content type ''text/markdown''. Note that this is necessary for being able to convert the markdown to HTML.

Note that if the file's content type is not set to ''text/markdown'', you won't see the preview tab or preview buttons.

You can find more information on Markdown in ReportServer in Section 13.

6.5. Accessing Resources by URL

Accessing files in the ReportServer File system via URL is possible, which greatly facilitates the embedding of images in reports. The corresponding URL format is:

http://SERVER/APPLICATIONFOLDER/reportserver/fileServerAccess?id=123

In this context, SERVER represents the server address (e.g., demo.raas.datenwerke.net), and APPLICATIONFOLDER corresponds to the installation path in your application server (e.g., Tomcat). The default setting is "reportserver". By utilizing the property ID, you can directly access a specific file.

You also have the option to access the file using its key:

http://SERVER/APPLICATIONFOLDER/reportserver/fileServerAccess?key=MY_KEY

where MY_KEY represents the key associated with your file.

Furthermore, accessing the file by its path is supported:

http://SERVER/APPLICATIONFOLDER/reportserver/fileServerAccess?path=/path/to/your/file

For example, the following URL retrieves the contents of your alias.cf configuration file:

http://SERVER/APPLICATIONFOLDER/reportserver/fileServerAccess?path=/etc/sso/ldap.cf

Additionally, you can utilize the following URL attributes:

id Represents the ID of a file, for example: id=123.
key Denotes the key associated with your file, such as: key=MY_KEY.
path Specifies the path to a file, for instance: path=/resources/images/img.jpg.
thumbnail If the file is of type image/png or image/jpeg, it can be automatically scaled. Activating the thumbnail option enables scaling mode in ReportServer. Example: thumbnail=true.
twidth Defines the width of the resulting thumbnail preview image, e.g., twidth=200. Note that thumbnail must be set to true for this attribute to take effect.
download Setting this attribute to true results in the file being downloaded instead of displayed in the browser. Example: download=true.
folder Setting this attribute to true allows you to download an entire folder as a ZIP file. Note that download must be true for this attribute to work.
render Setting this attribute to true enables rendering of a specified file instead of displaying the original file. Currently supported file types include DOT and Markdown. Ensure that format is set and the file's content type is specified. Refer to Section 14. and 13. for more details.
format In conjunction with render, allows a file to be directly rendered. Supported formats include: html for Markdown, and svg, png, ps, json, json0, xdot, plain, and plain_ext for DOT. For more details on supported DOT formats, refer to https://github.com/nidi3/graphviz-java.

Please note that to access a file via URL, reading rights are required by default (see Chapter 3. User and Permission Management). This means that users must be logged in to the system. To enable full file sharing, consider placing them in a folder with the Share folder for web access option enabled.

Complete folders can also be accessed, but only via id and path, as they do not currently support keys. For folders, the following properties are available:

id Represents the ID of a folder, for example: id=123
path Indicates the path leading to a folder, e.g., path=/resources/images
folder This attribute should be set to true for folders. It is a mandatory field for folders, e.g., folder=true
download This attribute should also be set to true for folders. It is a mandatory field for folders, e.g., download=true

As an example, the following URL downloads a ZIP file containing your /resources folder:

http://SERVER/APPLICATIONFOLDER/reportserver/fileServerAccess?path=/resources&folder=true&download=true