# Report and Folder Storage/Management

By default, Exago stores the reports in a file system folder. The location of this folder is specified in the ‘Report Path’ property set in the Administration Console. Alternatively, report, template and folder storage, and retrieval can be handled by building a Web Service or .NET Assembly. This would allow for reports, folders and templates to be stored in a database. To do this, specify the Web Service or .NET Assembly in the Report Path of Main Settings. The Web Service or .NET Assembly should contain all of the methods specified in List of Methods.

NOTE. As of version 2017.1, the methods GetReportListXml, GetReportXml, and GetThemeXml are obsoleted by the methods GetReportList, GetReport, and GetTheme, respectively. Additionally, the theme type "ExpressView" has been added. Please adjust your methods accordingly. If you are upgrading to 2017.1 from an older version, please also see the note on the default ExpressView theme file in the Updating Guide.

# List of Methods

> NOTE. The methods will use the parameters ‘companyId’, and ‘userId’ which should be set through the Api as users enter Exago from the host application.

> NOTE. If using a .Net Assembly, the folder management code can use alternative method signatures to be passed Exago’s SessionInfo object for additional flexibility. See Accessing SessionInfo in Folder Management for more information.

string GetReportListXml(string companyId, string userId)

Description | Returns a string listing folders and report names in xml format (see example).
Remark | For reports set the flag <leaf_flag> to True. For folders set this flag to False. If an error occurs return null and a generic error will be displayed to the user. NOTE. As of version 2017.1, this method is obsolete. Use GetReportList instead.
Example |
    <entity>
       <name>Travis' Reports</name>
       <leaf_flag>false</leaf_flag>
       <readonly_flag>false</readonly_flag>
       <entity>
          <type>advanced</type>
          <name>Sales Report</name>
          <description>Contains sales information</description>
          <leaf_flag>true</leaf_flag>
          <readonly_flag>false</readonly_flag>
       </entity>
       <entity>
          <type>expressview</type>
          <name>Employee Reports</name>
          <description>Contains employee information</description>
          <leaf_flag>false</leaf_flag>
          <readonly_flag>false</readonly_flag>
          <entity>
             <type>dashboard</type>
             <name>Employee Benefits Report</name>
             <description>HR and Employee info</description>
             <leaf_flag>true</leaf_flag>
             <readonly_flag>false</readonly_flag>
          </entity>
       </entity>
    </entity>

string GetReportList(string companyId, string userId)

Description | Returns a string listing folders and report names in xml format (see example).
Remark | For reports set the flag <leaf_flag> to True. For folders set this flag to False. If an error occurs return null and a generic error will be displayed to the user.
Example |
    <entity>
       <name>Travis' Reports</name>
       <leaf_flag>false</leaf_flag>
       <readonly_flag>false</readonly_flag>
       <entity>
          <type>advanced</type>
          <name>Sales Report</name>
          <description>Contains sales information</description>
          <leaf_flag>true</leaf_flag>
          <readonly_flag>false</readonly_flag>
       </entity>
       <entity>
          <type>expressview</type>
          <name>Employee Reports</name>
          <description>Contains employee information</description>
          <leaf_flag>false</leaf_flag>
          <readonly_flag>false</readonly_flag>
          <entity>
             <type>dashboard</type>
             <name>Employee Benefits Report</name>
             <description>HR and Employee info</description>
             <leaf_flag>true</leaf_flag>
             <readonly_flag>false</readonly_flag>
          </entity>
       </entity>
    </entity>

string GetReportXml(string companyId, string userId, string reportName)

Description | Returns a string containing the report in xml format.
Remark | If an error occurs return null and a generic error will be displayed to the user. NOTE. As of version 2017.1 this method is obsolete. Use GetReport instead.

string GetReport(string companyId, string userId, string reportName)

Description | Returns a string containing the report in xml format.
Remark | If an error occurs return null and a generic error will be displayed to the user.

wrReportType? GetReportType(string companyId, string userId, string reportName)

Description | Returns the type of report as a wrReportType enum, or as an int describing the report type: 0 = Advanced 1 = Express 2 = Dashboard 3 = Chained 4 = Visualization 5 = ExpressView
Remark | Returns null if reportName does not exist. Any invalid type returns null. This will cause any report management methods to fail.

string SaveReport(string companyId, string userId, string reportName, string reportXml)

Description | Saves a report (reportName is fully qualified)
Remark | Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches the id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

string DeleteReport(string companyId, string userId, string reportName)

Description | Deletes a report (reportName is fully qualified)
Remark | Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

string RenameReport(string companyId, string userId, string reportName, string newReportName)

Description | Renames a report (reportName & newReportName are fully qualified). If this method is not provided, DeleteReport and SaveReport will be called.
Remark | Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

string AddFolder(string companyId, string userId, string folderName)

Description | Adds a report folder (folderName is fully qualified). Folder should not be named to one that already exists.
Remark | Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

string DeleteFolder(string companyId, string userId, string folderName)

Description | Deletes a report folder (folderName is fully qualified).
Remark | Exago’ default report template management will not allow a folder to be deleted that contains any reports. Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

string RenameFolder(string companyId, string userId, string oldName, string newName)

Description | Renames a report folder (folder names are fully qualified). Folder should not be moved to a location where a Folder with a matching name already exists.
Remark | Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

string MoveFolder(string companyId, string userId, string oldName, string newName)

Description | Moves a report folder (folder names are fully qualified). Folder should not be renamed to one that already exists.
Remark | Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

bool ExistFolder(string companyId, string userId, string folderName)

Description | Determines if a folder exists.
Remark | Returns true or false.

List<string> GetTemplateList(string companyId, string userId)

Description | Returns a list of strings or a string array containing the available templates.
Remark | If an error occurs return null and a generic error will be displayed to the user.

byte[] GetTemplate(string companyId, string userId, string templateName)

Description | Returns a byte array containing the template.
Remark | If an error occurs return null and a generic error will be displayed to the user.

string SaveTemplate(string companyId, string userId, string templateName, byte[] templateData)

Description | Saves a template
Remark | Returns an error message if one occurs, else return null. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

List<string> GetThemeList(string companyId, string userId, string themeType)

Description | Returns a list of strings or a string array containing the available themes.
Remark | Valid values of themeType: “CrossTab”, “Express”, “Chart”, “Map”, “Gauge”, “ExpressView” If an error occurs return null and a generic error will be displayed to the user.

bool ExistTheme(string companyId, string userId, string themeType, string themeName)

Description | Determines if a theme exists.
Remark | Valid values of themeType: “CrossTab”, “Express”, “Chart”, “Map”, “Gauge”, “ExpressView” Returns true or false.

string GetThemeXml(string companyId, string userId, string themeType, string themeXml)

Description | Returns a string representing the theme in xml format. NOTE. As of version 2017.1, this method is obsolete. Use GetTheme instead.
Remark | Valid values of themeType: “CrossTab”, “Express”, “Chart”, “Map”, “Gauge”, “ExpressView” If an error occurs return null and a generic error will be displayed to the user.

string GetTheme(string companyId, string userId, string themeType, string themeName)

Description | Returns a string representing the theme.
Remark | Valid values of themeType: “CrossTab”, “Express”, “Chart”, “Map”, “Gauge”, “ExpressView” If an error occurs return null and a generic error will be displayed to the user.

string SaveTheme(string companyId, string userId, string themeType, string themeName, string themeData)

Description | Saves a theme.
Remark | Valid values of themeType: “CrossTab”, “Express”, “Chart”, “Map”, “Gauge”, “ExpressView” Returns an error message if one occurs, else return null. NOTE. As of version 2017.1, we recommend renaming the themeXml parameter to themeData, to reflect the fact that the newer themes are no longer Xml. NOTE. To support multi-language functionality, if the returned string matches an id of any element in the language files then the string of that language element will be displayed to the user instead of the returned value. For more information see Multi-Language Support.

# Accessing SessionInfo in Folder Management

This section only applies to Folder Management using a .Net Assembly.

After adding a reference to WebReportsApi.dll you may gain additional flexibility by replacing companyId and userId with Exago’ sessionInfo object in the methods listed above. The sessionInfo object grants access to all of the parameters, configuration, and report information of the Exago session. See Exago SessionInfo for more information.

To utilize the sessionInfoObject replace the companyId and userId parameters in the method signatures above with sessionInfo sessionInfo (see example below).

> NOTE. To use the sessionInfoObject all the methods must be static.

Utilizing the sessionInfo object will allow the folder management code to access much more information about the user and/or Exago. For example the capability to access the sessionInfo object could be used to pass additional parameters to your folder management code such as the preferred language of the user or from which part of the host application they entered Exago.

> NOTE. Passing the sessionInfo object will lock the folder management Assembly. In order to unlock the assembly, either IIS will need to be restarted, or the application pool running Exago will need to be recycled.

The following is an example of the method signature for GetReportXml to utilize the sessionInfo object.

string GetReportXml(SessionInfo sessionInfo, string reportName)

Description | Returns a string containing the report in xml format.
Remark | If an error occurs return null and a generic error will be displayed to the user. companyId and userId can still be retrived using the calls sessionInfo.SetupData.Parameters.GetValue(‘comapnyId’) and sessionInfo.SetupData.Parameters.GetValue(‘userId’) respectively. The sessionInfo object must be the first parameter in the method.