onReportRequest - event of object PmReport

The event fires on output report request (i.e. when the report is to be displayed in local or Web window, when calling the SaveToFile or SaveToString methods). The event is used for updating the report (see the automatic way of update described in PmReport).
pMe(Object) Reference to the PROMOTIC object where the event rises.
pEvent(Object) A referrence to object describing detailed information about the specific event.
pEvent.Context - (Object) Contains a link to a object with additional information about the calling context (e.g. the user).
pEvent.Context.User - (Object) property with User object referrence, containing detailed information about the user (local or network), that called the method. It can be used for example:
- for protecting the method for specific logged user or user group.
- for storing and reading the private user state data using the methods SetPrivateData and GetPrivateData.

Caution! In order to keep the subobject User value trustworthy it is necessary to exclude the the pseudo-groups $ANY and $ANY_NET from the appropriate permission WebRead (i.e. to ensure that the user is logged in when opening the Web page).

pEvent.Context.Language - (String) it returns the information about the national language, to be used for text outputs of the method (suitable especially for calling the method from Web panels). Language is determined with a text identifier, e.g. "en", "de", "ru" etc. - see Fully supported languages in the PROMOTIC system.
pEvent.Pars - (Object) Contains a reference to an object with additional parameters of the report, provided when the viewer is opened (See sParams default value or Object viewer open). Each separate parameter consists of an identifier (name) and a value. These parameters can be used for parametrizing the contents of the report when the viewer is opened. It is possible to use these parameters to parametrize the data being read in the onReportRequest event and also to pass the values of these parameters directly into the report as keywords.

Each parameter can be accessed via the following methods of this object:

pEvent.Pars.GetValueAt - Syntax: GetValueAt(sId As String) As String. The method allows to obtain the value of one parameter according to its identifier (name). If the requested parameter doesn't exist, then an Empty value is returned.
pEvent.Modify - (Long) The output value indicating whether the key values or template file has been updated and the need to re-create the report (see the MakeReport method).
0 - No modification occured, the report wil not be re-created (the cached report of the PmReport object will be used).
1 - Some modification occured, the output report must be re-created.
The example shows the reading of two parameetrs named (par1 and par2) obtained when opening the viewer and their transmission to the report update (template transformation) as keywords.
VBScriptSelect and copy to clipboard

pEvent.Modify = 1
pMe.SetKeyValue "kPar1", pEvent.Pars.GetValueAt("par1")
pMe.SetKeyValue "kPar2", pEvent.Pars.GetValueAt("par2")
PROMOTIC 8.3.29 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice