GetAnalysis Script Examples: Difference between revisions

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 97: Line 97:
(SELECT 'DataTableName', 'ExampleTable') UNION ALL  
(SELECT 'DataTableName', 'ExampleTable') UNION ALL  
(SELECT 'TargetTable', '#CSV1')  
(SELECT 'TargetTable', '#CSV1')  
--#GetAnalysis
</pre>
The following example will get a Data Table Report analysis, store the analysis results to a temporary table called "#DataTableResult" and show the results on an Excel sheet. This table contains the same information as is visible in the Project Workspace. For explanations of the columns, see Data Tables.
<pre>
(SELECT 'AnalysisType', '23') UNION ALL
(SELECT 'Show', '1') UNION ALL
(SELECT 'TargetTable', '#DataTableResult')
--#GetAnalysis
--#GetAnalysis
</pre>
</pre>
Line 134: Line 126:
(SELECT 'TargetTable', '#ScriptReport')
(SELECT 'TargetTable', '#ScriptReport')
--#GetAnalysis
--#GetAnalysis
</pre>
The following example will get operation log report for 14th March 2016. It will put the information to the "#OperationReport" temporary table. It will then also show the contents of that table.
<pre>
(SELECT 'AnalysisType', '12') UNION ALL
(SELECT 'MinStartTime', '2016-03-14T00:00:00') UNION ALL
(SELECT 'MaxStartTime', '2016-03-14T23:59:59') UNION ALL
(SELECT 'MaxTextLength', '12') UNION ALL
(SELECT 'TargetTable', '#OperationReport')
--#GetAnalysis
(SELECT * FROM #OperationReport)
(SELECT 'Title', 'Operation Log Report')
--#ShowReport
</pre>
</pre>

Revision as of 18:34, 15 June 2023

This page contains script examples for the GetAnalysis script command.

This example runs an expression analysis.

(SELECT 'AnalysisType', '33') UNION ALL
(SELECT 'ModelId', '123') UNION ALL
(SELECT 'Show', 'True') UNION ALL
(SELECT 'Configuration', '
{
	"Root": "Cases",
	"Dimensions": [
		{
			"Name": "Date",
			"Expression": "Duration.TotalDays"
			"NumberPrecision": 0
		}
	],
	"Values": [
		{
			"Name": "Count",
			"Expression": "Count(_)"
		}
	],
	"Ordering": [
		{
			"Name": "Date",
			"Direction": "Ascending"
		}
	]
}
')
--#GetAnalysis

Cases list:

(SELECT 'AnalysisType', '33') UNION ALL
(SELECT 'ModelId', '123') UNION ALL
(SELECT 'Show', 'True') UNION ALL
(SELECT 'Configuration', '
{
	"Root": "Cases",
	"Dimensions": null,
	"Values": [
		{
			"Name": "dimension0",
			"Expression": "Name"
		},
		{
			"Name": "dimension1",
			"Expression": "StartTime"
		},
		{
			"Name": "dimension2",
			"Expression": "EndTime"
		},
		{
			"Name": "dimension3",
			"Expression": "Duration.TotalDays"
		},
		{
			"Name": "dimension4",
			"Expression": "LastEvent.TypeName"
		},
		{
			"Name": "dimension5",
			"Expression": "Variation.EventTypeCount"
		},
		{
			"Name": "dimension6",
			"Expression": "Variation.UniqueEventTypeCount"
		}
	],
	"MaximumRowCount": 200
}
')
--#GetAnalysis

This example runs an expression analysis with a root expression only.

(SELECT 'AnalysisType', '33') UNION ALL
(SELECT 'Show', 'True') UNION ALL
(SELECT 'Configuration', '
{
	"Root": "DatatableById(49).DataFrame.Where(Column(\"DELIVERY MODE\")==\"Truck\")",
}
')
--#GetAnalysis

The following example will load data from the "ExampleTable" data table in the "ExampleProject" project and put that data into the "CSV1" table.

(SELECT 'AnalysisType', '18') UNION ALL 
(SELECT 'ProjectName', 'ExampleProject') UNION ALL
(SELECT 'MaximumCount', '0') UNION ALL
(SELECT 'DataTableName', 'ExampleTable') UNION ALL 
(SELECT 'TargetTable', '#CSV1') 
--#GetAnalysis

The following example will run the script with ID "34" and returns the "ShowScript34Result" sheet that the script with ID "34" creates.

(SELECT 'AnalysisType', '25') UNION ALL
(SELECT 'Show', 'TRUE') UNION ALL
(SELECT 'SelectedAnalysisResult', 'ShowScript34Result') UNION ALL
(SELECT 'ScriptId', '34') 
--#GetAnalysis

The following example will get script log report for the scripts with ids "123" and "456" that have been started between 14th March 2016 02:20 and 18th March 2016 02:10. It will put the information to the "#ScriptReport" temporary table.

(SELECT 'AnalysisType', '32') UNION ALL
(SELECT 'ScriptId', '123,456') UNION ALL
(SELECT 'MinStartTime', '2016-03-14T02:10:00') UNION ALL
(SELECT 'MaxStartTime', '2016-03-18T02:10:00') UNION ALL
(SELECT 'TargetTable', '#ScriptReport')
--#GetAnalysis

The following example will get script log report for all scripts available for the user that have been started on 14th March 2016. It will put the information to the "#ScriptReport" temporary table.

(SELECT 'AnalysisType', '32') UNION ALL
(SELECT 'MinStartTime', '2016-03-14T00:00:00') UNION ALL
(SELECT 'MaxStartTime', '2016-03-14T23:59:59') UNION ALL
(SELECT 'TargetTable', '#ScriptReport')
--#GetAnalysis