Promotic

onReportRequest - event of the PmaReport object

Description:
The event is triggered on output report request (i.e. if the report is to be displayed in local or Web window, if calling the SaveToFile or SaveToString methods). The event serves for updating the report (see the automatic way of update described in the PmaReport object).
Parameters:
pMe(Object) Reference to the PmaReport object where the event rises.
pEvent(Object) Reference to the object describing detailed information about the specific event.
pEvent.Context - (Object) [for reading] Contains a link to a object with additional information about the calling context (e.g. the user).
pEvent.Context.User - (Object) property with referrence to the PmUser object, 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 by methods SetPrivateData and GetPrivateData.

Caution! In order to keep the subobject User value trustworthy it is necessary to exclude 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 when 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) [for reading] Contains a reference to an object with additional parameters of the report, provided when the viewer is opened (see sViewPars default value or Opening the viewer of the PmaReport object). Each separate parameter consists of an identifier (name) and a value. These parameters can be used for parametrizing the content 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: String GetValueAt(String sId). The method allows to obtain the value of one parameter according to its identifier (name).
If the requested parameter does not exist then the method returns: null for JavaScript or Empty for VBScript (it can be tested by the Pm.IsValid method).
pEvent.Modify - (Long) [for read and write] 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 PmaReport object will be used).
1 - Some modification occured, the output report must be re-created.
Example:
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.
JavaScriptVBScriptSelect and copy to clipboard

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

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.