GetAnalysis Script Examples

From QPR ProcessAnalyzer Wiki
Jump to navigation Jump to search

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