<< Clique para Mostrar o Sumário >>
The Session Parameter |
In the example of the previous topic, the session parameter was used. This parameter must always receive a session data type as input of a method. This parameter allows accessing information relative to an event, an execution context, and information about the last execution, among other information.
The next example shows how to use the timeEvent and range properties of the session parameter to work with the period of a query relative to the moment that method is executed.
import epmprocessor as epr
import epmwebapi as epm
import datetime
@epr.applicationMethod("MyMethod")
def my_method(session, param1, param2):
endtime = sessions.timeEvent
initime = endtime - datetime.timedelta(session.range)
queryPeriod = epm.QueryPeriod(initime, endtime)
pass
The next table contains the description of the properties of the session parameter.
Properties of the session parameter
Property |
Description |
---|---|
timeEvent |
Date and time of the event that generated the execution of a method. It can be informed manually in case of a test, in real time in case of a Production, or simulated in case of a Simulation |
range |
Time interval. Commonly used together with the timeEvent property to determine the start and end dates of queries to process data |
processInterval |
Processing time interval used in aggregation queries |
parametersMap |
List of global parameters of an Application, created using the New Session Parameter option |
userCache |
Execution memory, which can be used to transfer information between executions |
lastExecutedInfo |
Information about the last execution |
connections |
Variable containing all Connections used by the parameters of a method that require connections to an EPM Server |
scopeContext |
Contains information about the context of execution, that is, whether the evaluation of a method is performed via a test, a production execution, or a simulation |
NOTES |
•When creating methods, users must consider that the number of parameters is fixed and configured via EPM Processor Workbench. Therefore, methods using the applicationMethod decorator must not use args or kwargs parameters when creating them. •Users can create additional parameters for the session parameter using the New Session Parameter option. This option is available on the Test area of a Code Package. To be effectively used in Solutions, these additional parameters must be configured in their respective Applications. |