GetAnalysis Script Examples: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(20 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This page contains script examples for the [[ | This page contains script examples for the [[SQL Scripting Commands#--.23GetAnalysis|GetAnalysis]] script command. | ||
This example runs an [[Web_API:_Expression/query|expression analysis]]. | |||
<pre> | <pre> | ||
(SELECT 'AnalysisType', '33') UNION ALL | (SELECT 'AnalysisType', '33') UNION ALL | ||
Line 11: | Line 11: | ||
"Dimensions": [ | "Dimensions": [ | ||
{ | { | ||
" | "Name": "Date", | ||
" | "Expression": "Duration.TotalDays" | ||
"NumberPrecision": 0 | |||
} | } | ||
], | ], | ||
"Values": [ | "Values": [ | ||
{ | { | ||
" | "Name": "Count", | ||
" | "Expression": "Count(_)" | ||
} | } | ||
], | ], | ||
"Ordering": [ | "Ordering": [ | ||
{ | { | ||
" | "Name": "Date", | ||
"Direction": "Ascending" | "Direction": "Ascending" | ||
} | } | ||
] | ] | ||
}' | } | ||
) | ') | ||
--#GetAnalysis | --#GetAnalysis | ||
</pre> | </pre> | ||
Cases list: | |||
<pre> | <pre> | ||
(SELECT 'AnalysisType', ' | (SELECT 'AnalysisType', '33') UNION ALL | ||
(SELECT ' | (SELECT 'ModelId', '123') UNION ALL | ||
(SELECT ' | (SELECT 'Show', 'True') UNION ALL | ||
(SELECT ' | (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 | --#GetAnalysis | ||
</pre> | </pre> | ||
This example runs an expression analysis with a root expression only. | |||
<pre> | <pre> | ||
(SELECT 'AnalysisType', ' | (SELECT 'AnalysisType', '33') UNION ALL | ||
(SELECT 'Show', 'True') UNION ALL | |||
(SELECT 'Configuration', ' | |||
{ | |||
(SELECT 'Show', ' | "Root": "DatatableById(49).DataFrame.Where(Column(\"DELIVERY MODE\")==\"Truck\")", | ||
(SELECT ' | } | ||
') | |||
( | |||
( | |||
( | |||
--#GetAnalysis | --#GetAnalysis | ||
</pre> | </pre> | ||
The following example will load data from the "ExampleTable" data table in the "ExampleProject" project and put that data into the "CSV1" table. | The following example will load data from the "ExampleTable" data table in the "ExampleProject" project and put that data into the "CSV1" table. | ||
<pre> | <pre> | ||
Line 75: | Line 97: | ||
(SELECT 'DataTableName', 'ExampleTable') UNION ALL | (SELECT 'DataTableName', 'ExampleTable') UNION ALL | ||
(SELECT 'TargetTable', '#CSV1') | (SELECT 'TargetTable', '#CSV1') | ||
--#GetAnalysis | --#GetAnalysis | ||
</pre> | </pre> | ||
Line 275: | Line 108: | ||
--#GetAnalysis | --#GetAnalysis | ||
</pre> | </pre> | ||
Latest revision as of 14:21, 24 January 2024
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