QPR ProcessAnalyzer ScriptLauncher: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
Line 26: Line 26:
* '''ScriptId''': the ID of the script you want to run. You can copy the ID from the [[Manage Scripts in QPR ProcessAnalyzer Excel Client|Manage Scripts]] dialog in QPR ProcessAnalyzer Excel Client. If ScriptId is 0 (or less than 0), there will be an error written into the log.
* '''ScriptId''': the ID of the script you want to run. You can copy the ID from the [[Manage Scripts in QPR ProcessAnalyzer Excel Client|Manage Scripts]] dialog in QPR ProcessAnalyzer Excel Client. If ScriptId is 0 (or less than 0), there will be an error written into the log.
* '''OutputDirectory''': the folder where to store the created [[QPR_ProcessAnalyzer_ScriptLauncher#CSV_Export|CSV export file]]. If the folder doesn't exist, it will be created.
* '''OutputDirectory''': the folder where to store the created [[QPR_ProcessAnalyzer_ScriptLauncher#CSV_Export|CSV export file]]. If the folder doesn't exist, it will be created.
* '''Parameter_<Parameter name>''': passes the defined value of the <Parameter name> to the ProcessAnalyzer script being run. The script should have a corresponding "@_Parameter_<Parameter name>" variable(s) in the script. For example, the following would result in "5" being used in the ProcessAnalyzer script as the value of the variable @_Parameter_AnalysisType: <pre>Parameter_AnalysisType=5</pre>
* '''Parameter_<Parameter name>''': passes the defined value of the <Parameter name> to the ProcessAnalyzer script being run. The script should have a corresponding "@_Parameter_<Parameter name>" variable(s) in the script. For example, the following would result in "5" being used in the ProcessAnalyzer script as the value of the variable @_Parameter_AnalysisType:  
<pre><setting name="Parameters" serializeAs="Xml">
  <value>
    <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <string>AnalysisType=5</string>
    </ArrayOfString>
  </value>
</setting></pre>
 
Note that it is possible to add more than one string.
 
The type of the parameter value is always NVARCHAR.
The type of the parameter value is always NVARCHAR.



Revision as of 10:56, 26 March 2019

QPR ProcessAnalyzer ScriptLauncher is a tool which enables you to run QPR ProcessAnalyzer scripts on a QPR ProcessAnalyzer Server. QPR ProcessAnalyzer ScriptLauncher is part of the installation package of QPR ProcessAnalyzer and includes the following files (in addition to DLL files and an XML file):

  • Qpr.ProcessAnalyzer.ScriptLauncher.exe (an executable file)
  • Qpr.ProcessAnalyzer.ScriptLauncher.exe.config (a configuration file)

These files are located in the QPR Connector folder that is under the QPR ProcessAnalyzer Installation folder (e.g. C:\Program Files (x86)\QPR ProcessAnalyzer 2015\QPR Connector). Note that QPR Connector needs to be selected to be installed when installing QPR ProcessAnalyzer (by default it is).

Configuring QPR ProcessAnalyzer ScriptLauncher

Before you can start running scripts with QPR ProcessAnalyzer ScriptLauncher, you need to configure the connection and other parameters for the tool.

Note: You need to have write access to the folder where the files for QPR ProcessAnalyzer ScriptLauncher are located.

1. Open the Qpr.ProcessAnalyzer.ScriptLauncher.exe.config file in a text editor.
2. Within that file, go to the following section:

<userSettings>
  <Qpr.ProcessAnalyzer.ScriptLauncher.Properties.Settings>

3. Configure the values for the following parameters:

  • ConnectionType: Service (if you are connecting to a service) or Database (if you are connecting to a connection string)
  • LogOnName: your QPR ProcessAnalyzer username
  • Password: your QPR ProcessAnalyzer password
  • ConnectionString: the connection string to the QPR ProcessAnalyzer database (e.g. Server=localhost;DataBase=<database_name>;Trusted_Connection=True)
  • ServiceUrl: the URL of your service
  • ProjectId: the ID of the project (0 = default)
  • ModelId: the ID of the model (0 = default)
  • FilterId: the ID of the filter (0 = default)
  • ScriptId: the ID of the script you want to run. You can copy the ID from the Manage Scripts dialog in QPR ProcessAnalyzer Excel Client. If ScriptId is 0 (or less than 0), there will be an error written into the log.
  • OutputDirectory: the folder where to store the created CSV export file. If the folder doesn't exist, it will be created.
  • Parameter_<Parameter name>: passes the defined value of the <Parameter name> to the ProcessAnalyzer script being run. The script should have a corresponding "@_Parameter_<Parameter name>" variable(s) in the script. For example, the following would result in "5" being used in the ProcessAnalyzer script as the value of the variable @_Parameter_AnalysisType:
<setting name="Parameters" serializeAs="Xml">
  <value>
    <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <string>AnalysisType=5</string>
    </ArrayOfString>
  </value>
</setting>

Note that it is possible to add more than one string.

The type of the parameter value is always NVARCHAR.

The context in which the script will be run depends on the configuration of the parameters for the different ID's listed above in the following order, so that the first found context definition in the configuration file will be used when running the script:

  1. FilterId (in case the value for this parameter is greater than 0)
  2. ModelId (in case the value for this parameter is greater than 0)
  3. ProjectId (in case the value for this parameter is greater than 0)
  4. The context of the analysis the user has last opened

4. In case you want to change location of the log file that will be created, you can do that by changing the value of the parameter LogFilePath in the following section of the configuration file:

<applicationSettings>
  <Qpr.ProcessAnalyzer.Common.Properties.Settings>
    <setting name="LogFilePath" serializeAs="String">
      <value>.\Qpr.ProcessAnalyzer.ScriptLauncher.log</value>
    </setting>
  </Qpr.ProcessAnalyzer.Common.Properties.Settings>
</applicationSettings>

Note that the log folder needs to exist before running QPR ProcessAnalyzer ScriptLauncher and you must have rights to write to that folder.
By default, the log file will be stored in the same folder as the configuration file.

Running QPR ProcessAnalyzer ScriptLauncher

After you have configured the parameters as explained in the section above, run Qpr.ProcessAnalyzer.ScriptLauncher.exe. You can also run it from Command Prompt. Note: You need to have RunScripts rights assigned to you in QPR ProcessAnalyzer.

Using Command Line Parameters

All the supported configuration settings can be specified from the command line used to launch QPR ProcessAnalyzer ScriptLauncher by using command line parameters. The settings in the configuration file are used as defaults which the command line parameters override. The parameters are case sensitive.

To specify a setting via the command line, use the following format:
-<Setting>=<Value>

For example:

Qpr.ProcessAnalyzer.ScriptLauncher.exe -ScriptId=123 -ProjectId=1234 -ModelId=12345 -FilterId=432

Setting values that contain some special characters, such as spaces, must be escaped by using double quotes. For example:

-LogFilePath="C:\Temp\Path to My Log Files\ScriptLauncherDir\"

CSV Export

When the ProcessAnalyzer script that is run contains a GetAnalysis command with a "Show=TRUE" parameter or a ShowReport command, the analysis is exported into a CSV file. The name of the exported file will be the same as the Excel sheet name when the script is run using ProcessAnalyzer Excel client. If there are multiple Show commands with the same Excel sheet name, the newest one will overwrite the older file(s). Only tabular analysis types are supported. The following settings are in use in the CSV file:

  • Decimal separator: '.' (i.e. period)
  • Field separator: ';' (i.e. semicolon)
  • Quotation character for all text fields: '"' (i.e. double quote)
  • First line: column headers
  • Date format: "yyyy-MM-dd HH:mm:ss,fff"

When the script has been run, script progress will be written to the specified log file, Qpr.ProcessAnalyzer.ScriptLauncher.log. The information shown in the log is the same as in QPR_ProcessAnalyzer_Logs#Progress_Log.