Run Script Examples

From QPR ProcessAnalyzer Wiki
Revision as of 08:50, 20 June 2016 by TeeHiet (talk | contribs) (403051)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This page contains script examples for the 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>.

(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', '<ScriptId>')
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