Custom Functions, Server Events, Action Events, and Assembly Data Sources can access the Exago 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.
NoteSince 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:
JavascriptAction.SetJsCode(string sCode)
: Pass the client side code as a string. The Action Event must return the JavascriptAction object.
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.
Note pre-v2020.1The reportName is relative to the session's report path.
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 the Internal Parameters article for more information.
GetReportParameter(string parameterName)
Returns the specified Parameter object that is utilized by the report being executed. See the Internal Parameters article for more information.
NoteIf 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 the Internal Parameters article for more information.
WriteLog(string text)
Writes the specified text to Exago’s log file.
NoteThe 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.
Calling Functions
To call an Exago function in your 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