SessionInfo
Custom Functions, Server Events, Action Events, and Assembly Data Sources can access the Exago BI session state through a sessionInfo object. Access to sessionInfo allows powerful capabilities such as the ability to persist values across function invocations, allowing each invocation to be aware of previous calls and behave accordingly.
Properties
PageInfo
This is the parent of all information in the current session. Included are the active Report and SetupData objects.
Since the Report and SetupData objects are accessed frequently, direct pointers are included for these objects.
Report
An object that contains all of the report’s Data Object, sort, filter, and layout information.
SetupData
An object that contains all of the session’s configuration settings including Functions, Parameters, Data Objects, Joins, Roles, etc.
CompanyId
Contains the value specified by the system CompanyId parameter.
UserId
Contains the value specified by the system UserId parameter.
JavascriptAction
This object is set when sessionInfo is called from an Action Event. It is primarily used to load the client-side JavaScript:
sessionInfo.JavascriptAction.SetJsCode(string sCode)
Methods
GetReportExecuteHtml(string reportName)
Executes the specified report and returns its HTML output. This could be used to embed a report within a cell of another report.
The reportName is relative to the session’s report path in pre-v2020.1.
GetParameter(string parameterName)
Returns the specified Parameter object. GetParameter
first looks in the Report Parameter collection (parameters being utilized by the report) and then in the Config Parameter collection, as well as other parameters such as hidden parameters or multi-tenant values. See Internal Parameters
GetReportParameter(string parameterName)
Returns the specified Parameter object that is utilized by the report being executed. See Internal Parameters.
If a parameter is prompting a user for a value it will be available with the prompted value.
GetConfigParameter(string parameterName)
A method that returns the Parameter object stored in the default configuration. See Internal Parameters.
WriteLog(string text)
Writes the specified text to Exago BI’s log file.
The following methods utilize Stored Values which are objects that can be created and set by Custom Functions during report execution to pass data between calls. Stored Values only exist for the duration of report execution.
GetStoredValue(string valueName, object initialValue = null)
Retrieves a Stored Value. If a there is no Stored Value with the specified valueName
, then one will be created with the specified initialValue
.
SetStoredValue(string valueName, object newValue)
Sets the value of a Stored Value. Setting newValue
to null will delete the Stored Value.
string Report.GetCustomOptionValue(string id)
Description | Returns the value of the specified Custom Option as a string. |
---|---|
Remarks | For Bool options the value returned will be true or false. For List Options, the chosen Id is returned.
|
Example | A Custom Function could use the following C# code to return the value of a Custom Option. The Id of the Option is entered as an argument of the Custom Function.
|
Calling Functions
To call an Exago BI function in an extension, use the WebReports.Api.Reports.CellFormula
class and return the method CellFormula.Evaluate(null)
.
Example
CellFormula formula = CellFormula.CreateFormula(sessionInfo.PageInfo, formulaText, CellVariableCollectionFilter.DataField); return formula.Evaluate(null);
CellVariableCollectionFilter types:
- DataField
- AggFunction
- CellReference
- LinkedReport
- Parameter
- WidgetCellReference
- All