GetAnalysis Script Examples
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 get a Case analysis and open that analysis with "Case Analysis From Script" as the title on a sheet named "Case Analysis Sheet".
(SELECT 'AnalysisType', '5') UNION ALL (SELECT 'ProjectName', '<ProjectName>') UNION ALL (SELECT 'ModelName', '<ModelName>') UNION ALL (SELECT 'MaximumCount', '10') UNION ALL (SELECT 'Title', 'Case Analysis From Script') UNION ALL (SELECT 'SheetName', 'Case Analysis Sheet') UNION ALL (SELECT 'Show', 'True') --#GetAnalysis
The following example will get an Event analysis, open that analysis with "Analysis Title" as the title on a sheet named "Example Sheet Name", and store the Event analysis results to the "#ExampleTable" data table.
(SELECT 'AnalysisType', '6') UNION ALL (SELECT 'MaximumCount', '0') UNION ALL (SELECT 'FilterId', '3') UNION ALL (SELECT 'SelectedEventAttributes', '*') UNION ALL (SELECT 'Show', '1') UNION ALL (SELECT 'Title', 'Analysis Title') UNION ALL (SELECT 'SheetName', 'Excel Sheet Name') UNION ALL (SELECT 'TargetTable', '#ExampleTable') --#GetAnalysis
The following example will get a Duration analysis and open that analysis with "Duration Analysis From Script" as the title on a sheet named "Duration Analysis Sheet".
(SELECT 'AnalysisType', '9') UNION ALL (SELECT 'ProjectName', '<ProjectName>') UNION ALL (SELECT 'ModelName', '<ModelName>') UNION ALL (SELECT 'MaximumCount', '0') UNION ALL (SELECT 'Granularity', '1') UNION ALL (SELECT 'Title', 'Duration Analysis From Script') UNION ALL (SELECT 'SheetName', 'Duration Analysis Sheet') UNION ALL (SELECT 'Show', 'True') --#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 get a Model Report analysis, store the analysis results to a temporary table called "#ModelResult" 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 Models.
(SELECT 'AnalysisType', '21') UNION ALL (SELECT 'Show', '1') UNION ALL (SELECT 'TargetTable', '#ModelResult') --#GetAnalysis
The following example will get a Project Report analysis, store the analysis results to a temporary table called "#ProjectResult" 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 Models.
(SELECT 'AnalysisType', '22') UNION ALL (SELECT 'Show', '1') UNION ALL (SELECT 'TargetTable', '#ProjectResult') --#GetAnalysis
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.
(SELECT 'AnalysisType', '23') UNION ALL (SELECT 'Show', '1') UNION ALL (SELECT 'TargetTable', '#DataTableResult') --#GetAnalysis
The following example will get a Script Report analysis, store the analysis results to a temporary table called "#ScriptResult" and show the results on an Excel sheet. This table contains the same information as is visible in the Manage Scripts dialog. For explanations of the columns, see Manage Scripts.
(SELECT 'AnalysisType', '24') UNION ALL (SELECT 'Show', '1') UNION ALL (SELECT 'TargetTable', '#ScriptResult') --#GetAnalysis
The following example will get an Influence Analysis based on the cases going through the "Customer pick-up" event type and put it on a sheet named "Influence Sheet".
(SELECT 'AnalysisType', '14') UNION ALL (SELECT 'ProjectId', '1') UNION ALL (SELECT 'ModelId', '1') UNION ALL (SELECT 'MaximumCount', '100') UNION ALL (SELECT 'IncludeDurations', 'TRUE') UNION ALL (SELECT 'DurationType', '0') UNION ALL (SELECT 'DurationWeightedByCost', 'FALSE') UNION ALL (SELECT 'SelectedActivities', '3') UNION ALL (SELECT 'PrettySelection', 'Event Types=Customer pick-up') UNION ALL (SELECT 'Title', 'Influence Analysis from Script') UNION ALL (SELECT 'SheetName', 'Influence Sheet') UNION ALL (SELECT 'Show', 'TRUE') --#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
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.
(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