Run Script Examples: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
This page contains script examples for the [[QPR ProcessAnalyzer Scripting Commands#--.23Run|Run]] script command.
This page contains script examples for the [[QPR ProcessAnalyzer Scripting Commands#--.23Run|Run]] script command.


In the following example, the script gets data from two data tables and passes that data to the script with Id equal to <ScriptId>.  
In this example, the script gets data from two datatables and passes the data to the script with Id 1234.


<pre>
<pre>
Line 16: Line 16:
--#GetAnalysis
--#GetAnalysis


(SELECT 'ScriptId', '<ScriptId>')
(SELECT 'ScriptId', '1234')
SELECT * FROM #DataTable1;
SELECT * FROM #DataTable1;
SELECT * FROM #DataTable2;
SELECT * FROM #DataTable2;

Revision as of 16:33, 7 September 2020

This page contains script examples for the Run script command.

In this example, the script gets data from two datatables and passes the data to the script with Id 1234.

(SELECT 'AnalysisType', '18') UNION ALL
(SELECT 'MaximumCount', '0') UNION ALL
(SELECT 'DataTableId', '<DataTableId_1>') UNION ALL
(SELECT 'TargetTable', '#DataTable1')
--#GetAnalysis

(SELECT 'AnalysisType', '18') UNION ALL
(SELECT 'MaximumCount', '0') UNION ALL
(SELECT 'DataTableId', '<DataTableId_2>') UNION ALL
(SELECT 'TargetTable', '#DataTable2')
--#GetAnalysis

(SELECT 'ScriptId', '1234')
SELECT * FROM #DataTable1;
SELECT * FROM #DataTable2;
--#Run

Then it runs that script with the following parameters: the number of arguments is 2 (that is, @_Argv=2). #_Arg1 takes data from the <DataTableId_1> data table and #_Arg2 from the <DataTableId_2> data table.

print 'Number of arguments: ' + cast(@_Argv as varchar(100));

SELECT * from #_Arg1;
(SELECT 'MaximumCount', '0')
--#ShowReport

SELECT * from #_Arg2;
(SELECT 'MaximumCount', '0')
--#ShowReport