Difference between revisions of "ADE Server Class Reference"

(Make ADE«ver» adapt to ver)
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
[[Category: Analytica Decision Engine]]
 
[[Category:ADE User Guide]]
 
[[Category:ADE User Guide]]
[[ADE User Guide]] >
+
{{ReleaseBar}}
  
The five ADE server classes are [[CAEngine]], [[CAObject]], [[CATable]], [[CAIndex]], and [[CARenderingStyle]]. They are listed below in that order, with a complete description of the properties and methods of each class.
+
<languages />
 +
<translate>
 +
<!--T:1-->
 +
[[ADE User Guide]] >
  
=[[CAEngine]] =
+
<!--T:2-->
==Creation==
+
These are the ADE server classes:
  
Use of ADE really starts with the creation of a [[CAEngine]] object, from which all else flows. If you are using the ADEW.dll in-process server, you can only create and use one [[CAEngine]] instance. If you are using the ADE.exe out-of-process server, you may create as many [[CAEngine]] instances as you desire, each one running as a separate process. In web-based applications, a separate [[CAEngine]] instance is typically created for each user session.  Each [[CAEngine]] instance can have one model loaded at a time.
+
*[[CAEngine]] class contains methods and properties that allow you to open and close existing models, create new models, create new Analytica objects, and access Analytica objects contained in your model. Use of ADE really starts with the creation of a CAEngine object, from which all else flows.
 +
*[[CAObject]] is ADE's wrapper for an Analytica object, such as a variable or module. It provides access the the object's attributes, including its definition and result. It often is used as a stepping stone for obtaining a variable's result table.
 +
*[[CATable]] provides the equivalent of an intelligent array. It is used to wrap an Edit Table, allowing your program to change cell values, or a result array, allowing you to access individual cells, slices, or even a graph image of the result.
 +
*[[CAIndex]] provides information about the index of a [[CATable]].
  
You can either create a [[CAEngine]] instance directly, or by calling [[CALicense::NewCAEngine]]().  The later method requires you to first create a [[CALicense]] instance, but has the advantage that you can obtain further information about the cause of failure when creation fails.  Direct creation of [[CAEngine]] will fail if the license to use ADE on the given computer is invalid, expired, etc.  
+
*[[CARenderingStyle]] controls how atomic values are returned by ADE methods and properties. For example, you may want numbers returned numerically, or as formatted text. A [[CARenderingStyle]] is already present as a property on any [[CAObject]] or [[CATable]]. Separate default [[CARenderingStyle]] for both [[CAObject::DefTable|DefTables]] and [[CAObject::ResultTable|ResultTables]] are maintained on [[CAEngine::DefaultDefTableRenderingStyle]] and [[CAEngine::DefaultRenderingStyle]].  
  
See [[CAEngine]] for language-specific details.
+
*[[CALicense]] provides a method for instantiating a [[CAEngine]], and provides details about why such an instantiation failed, which would otherwise not be available if you instantiate the [[CAEngine]] directly. It also provides some information about limitations in your license to use [[ADE]].
  
==Properties==
+
*[[CAPicture]] holds an in-memory image atom when a result, or the cell of a result, is an image.
* {get,put} string [[CAEngine::Command|Command]]
 
* {get,put} CAObject [[CAEngine::CurrentModule|CurrentModule]]
 
* {get,put} [[CARenderingStyle]] [[CAEngine::DefaultDefTableRenderingStyle|DefaultDefTableRenderingStyle]]
 
* {get,put} [[CARenderingStyle]] [[CAEngine::DefaultRenderingStyle|DefaultRenderingStyle]]
 
* {get,put} long [[CAEngine::DefaultEvaluationTimeLimit|DefaultEvaluationTimeLimit]]
 
* {get} short int [[CAEngine::ErrorCode|ErrorCode]]
 
* {get} string [[CAEngine::ErrorText|ErrorText]]
 
* {get,put} unsigned long [[CAEngine::Flags|Flags]]
 
* {get} string [[CAEngine::Log|Log]]
 
* {get} string [[CAEngine::OutputBuffer|OutputBuffer]]
 
* {get,put} bool [[CAEngine::Photo|Photo]]
 
  
==Methods==
+
*[[CAGraphPivot]] provides information about the current pivot state of a graph, possible next pivots, and allows you to change the pivot of a graph.
* string [[CAEngine::AddModule|AddModule]](string filePath,bool Merge)
+
*[[CAFiller]] represents a graphing dimension for [[CAGraphPivot]]'s graphing roles.
* bool [[CAEngine::CloseModel|CloseModel]]()
 
* [[CAObject]] [[CAEngine::CreateObject|CreateObject]](string objName, string objType)
 
* bool [[CAEngine::CreateModel|CreateModel]](string newModelName)
 
* bool [[CAEngine::DeleteObject|DeleteObject]]( [[CAObject]] aObject )
 
* [[CAObject]] [[CAEngine::Get|Get]](string objName)
 
* [[CAObject]] [[CAEngine::GetObjectByName|GetObjectByName]](string objName)
 
* bool [[CAEngine::MonitorProcess|MonitorProcess]](long pid)
 
* string [[CAEngine::OpenModel|OpenModel]](string filepath)
 
* bool [[CAEngine::ReadScript|ReadScript]](string filePath)
 
* void [[CAEngine::ResetError|ResetError]]()
 
* bool [[CAEngine::SaveModel|SaveModel]](string filePath)
 
* bool [[CAEngine::SaveModuleFile|SaveModuleFile]](string moduleName, string filePath)
 
* bool [[CAEngine::Send|Send]]()
 
* bool [[CAEngine::SendCommand|SendCommand]](string command)
 
* bool [[CAEngine::SetCallbackObject|SetCallbackObject]](IUnknown* pObj)
 
  
= [[CAObject]] =
+
*[[IAdeUICallbacks]] is an interface that allows you to implement callbacks that are called when Analytica functions requiring user input are evaluated. You can implement these callbacks to support these user interface interactions in your own application. In many cases, the name of each method corresponds fairly directly with the name of the Analytica function that produces the user interaction. When your application does not implement this interface, most of the functions requiring user interaction will do nothing when evaluated in ADE.
==Creation==
 
  
A [[CAObject]] instances cannot be created directly. You must obtain a [[CAObject]] as the return results of other methods. The most common method used to obtain a [[CAObject]] is [[CAEngine::GetObjectByName]] (or its synonym, [[CAEngine::Get]]).
+
*[[IAdeUIWindowCallbacks]] is an interface which contains the ShowWindow() and CloseWindow() functions, and which is called when sending older typescript "Show windowType obj" and "Close windowType obj" commands. This allows the use of these commands in a more general fashion, including cases where scripts appear in conditionals, in functions, etc. When your application does not implement this interface, these newer functions will do nothing when evaluated in ADE, and the script commands will perform as in earlier releases.
 +
<br/>
  
==Properties==
+
The "IAde" prefix stands for "Interface ADE".  Your own code can define a class that subclasses this interface and implements its method, and then pass it to [[CAEngine::SetCallbackObject]].
* {get,put} string [[CAObject::ClassType|ClassType]]
 
* {get} short int [[CAObject::DefinitionType|DefinitionType]]
 
* {get,put} long [[CAObject::MethodEvaluationTimeLimit|MethodEvaluationTimeLimit]]
 
* {get,put} string [[CAObject::Name|Name]]
 
* {get,put} [[CARenderingStyle]] [[CAObject::RenderingStyle|RenderingStyle]]
 
* {get,put} short int [[CAObject::ResultType|ResultType]]
 
 
 
==Methods==
 
 
 
* bool [[CAObject::CreateDefTable|CreateDefTable]](SAFEARRAY indexArray)
 
* [[CATable]] [[CAObject::DefTable|DefTable]]()
 
* [[CATable]] [[CAObject::Evaluate|Evaluate]](string expression)
 
* variant [[CAObject::GetAttribute|GetAttribute]](string attName)
 
* bool [[CAObject::PictureToFile|PictureToFile]](string fileName, string mimeType)
 
* bool [[CAObject::PictureToStream|PictureToStream]](IStream stream, string mimeType)
 
* variant [[CAObject::Result|Result]]()
 
* [[CATable]] [[CAObject::ResultTable|ResultTable]]()
 
* bool [[CAObject::SetAttribute|SetAttribute]](string attName, variant attValue)
 
 
 
= [[CATable]] =
 
==Creation==
 
==Properties==
 
* {get,put} int [[CATable::GraphHeight|GraphHeight]]
 
* {get,put} int [[CATable::GraphWidth|GraphWidth]]
 
* {get,put} bool [[CATable::GraphWithStoredPivot|GraphWithStoredPivot]]
 
* {get} variant [[CATable::IndexNames|IndexNames]]
 
* {get,put} string [[CATable::Name|Name]]
 
* {get} short int [[CATable::NumDims|NumDims]]
 
* {get,put} [[CARenderingStyle]] [[CATable::RenderingStyle|RenderingStyle]]
 
* {get,put} short int [[CATable::ResultType|ResultType]]
 
* {get,put} string [[CATable::TableType|TableType]]
 
 
 
==Methods==
 
* variant [[CATable::AtomicValue|AtomicValue]]()
 
* variant [[CATable::GetDataByElements|GetDataByElements]](variant indexPtrs)
 
* variant [[CATable::GetDataByLabels|GetDataByLabels]](variant indexLabels)
 
* [[CAIndex]] [[CATable::GetIndexObject|GetIndexObject]](string indexName)
 
* variant [[CATable::GetSafeArray|GetSafeArray]]()
 
* bool [[CATable::GraphToFile|GraphToFile]](string fileName, string mimeType)
 
* bool [[CATable::GraphToStream|GraphToStream]](IStream stream, string mimeType)
 
* string [[CATable::IndexName|IndexName]](short int indexNum)
 
* bool [[CATable::ObtainTable|ObtainTable]]()
 
* bool [[CATable::PutSafeArray|PutSafeArray]](variant theVal)
 
* bool [[CATable::SetDataByElements|SetDataByElements]](variant elementValue, variant indexPtrs)
 
* bool [[CATable::SetDataByLabels|SetDataByLabels]](variant elementValue, variant indexLabels)
 
* bool [[CATable::SetIndexOrder|SetIndexOrder]](SAFEARRAY<string> indexArray)
 
* [[CATable]] [[CATable::Slice|Slice]]([[CAIndex]] index, int i)
 
* [[CATable]] [[CATable::Subscript|Subscript]]([[CAIndex]] index, variant label)
 
* bool [[CATable::Update|Update]]()
 
 
 
= [[CAIndex]] =
 
==Creation==
 
==Properties==
 
* {get} long [[CAIndex::IndexElements|IndexElements]]
 
* {get,put} string [[CAIndex::Name|Name]]
 
* {get,put} [[CARenderingStyle]] [[CAIndex::RenderingStyle|RenderingStyle]]
 
 
 
==Methods==
 
* long [[CAIndex::GetNumberByValue|GetNumberByValue]](variant val)
 
* variant [[CAIndex::GetValueByNumber|GetValueByNumber]](long i)
 
* bool [[CAIndex::ObtainIndex|ObtainIndex]](string indName)
 
 
 
= [[CARenderingStyle]] =
 
==Creation==
 
==Properties==
 
* {get,put} bool [[CARenderingStyle::FullPrecision|FullPrecision]]
 
* {get,put} bool [[CARenderingStyle::GeneralExpression|GeneralExpression]]
 
* {get,put} short [[CARenderingStyle::HandleFormat|HandleFormat]]
 
* {get,put} bool [[CARenderingStyle::NewLineAsCRLF|NewLineAsCRLF]]
 
* {get,put} variant [[CARenderingStyle::NullValue|NullValue]]
 
* {get,put} bool [[CARenderingStyle::NumberAsText|NumberAsText]]
 
* {get,put} bool [[CARenderingStyle::ReferenceAsText|ReferenceAsText]]
 
* {get,put} long [[CARenderingStyle::SafeArrayLowerBound|SafeArrayLowerBound]]
 
* {get,put} short [[CARenderingStyle::StringQuotes|StringQuotes]]
 
* {get,put} variant [[CARenderingStyle::UndefValue|UndefValue]]
 
* {get,put} short [[CARenderingStyle::VarTermFormat|VarTermFormat]]
 
 
 
==Methods==
 
 
 
''none''
 
 
 
= [[CALicense]] =
 
==Creation==
 
==Properties==
 
* {get} long [[CALicense::AvailableLicenseInstances|AvailableLicenseInstances]]
 
* {get} bool [[CALicense::CanUseOptimizer|CanUseOptimizer]]
 
* {get} short int [[CALicense::ErrorCode|ErrorCode]]
 
* {get} string [[CALicense::ErrorText|ErrorText]]
 
* {get} long [[CALicense::MaxLicenseInstances|MaxLicenseInstances]]
 
* {get} string [[CALicense::RlmHostId|RlmHostId]]
 
* {get} string [[CALicense::RlmPath|RlmPath]]
 
* {get} string [[CALicense::RlmUserId|RlmUserId]]
 
 
 
==Methods==
 
* [[CAEngine]] [[CALicense::NewCAEngine|NewCAEngine]]()
 
* void [[CALicense::SetApplicationLicenseCode|SetApplicationLicenseCode]](string)
 
  
= [[IAdeUICallbacks]] =
 
  
 
''New to [[Analytica 4.6|ADE 4.6]]''
 
''New to [[Analytica 4.6|ADE 4.6]]''
  
This interface allows you to implement callbacks that are called when Analytica functions requiring user input are evaluated. You can implement these callbacks to support these user interface interactions in your own application. In many cases, the name of each method corresponds fairly directly with the name of the Analytica function that produces the user interaction.
+
== Examples == <!--T:20-->
 
 
When your application does not implement this interface, most of the functions requiring user interaction will do nothing when evaluated in ADE.
 
 
 
The "IAde" prefix stands for "Interface ADE".  Your own code can define a class that subclasses this interface and implements its method, and then pass it to [[CAEngine::SetCallbackObject]].
 
 
 
== Methods ==
 
 
 
* long [[IAdeUICallbacks::MsgBox|MsgBox]]([in] string title, [in] string text, [in] long buttons)
 
* bool [[IAdeUICallbacks::ShowProgressBar|ShowProgressBar]]([in] string title, [in] string text, [in] double p)
 
* void [[IAdeUICallbacks::HideProgressBar|HideProgressBar]]()
 
* string [[IAdeUICallbacks::AskMsgText|AskMsgText]]([in] string question, [in] string title, [in] long maxText, [in] string defaultText, [in] bool bPassword, [out] bool* bCancel)
 
* double [[IAdeUICallbacks::AskMsgNumber|AskMsgNumber]]([in] string question, [in] BSTR title, [in] bool bShowDefault, [in] double defaultNumber, [out] bool* bCancel)
 
* long [[IAdeUICallbacks::AskMsgChoice|AskMsgChoice]](([in] string question, [in] BSTR title, [in] array<string> optionList, [in] long defaultPosition, [in] bool bShowAll, [out] bool* bCancel)
 
* string [[IAdeUICallbacks::AskMsgComboBox|AskMsgComboBox]]([in] string question, [in] string title, [in] array<string> optionList, [in] string defaultText, [in] bool bShowAll, [out] bool* bCancel)
 
* string [[IAdeUICallbacks::GetFilename|GetFilename]]([in] string function, [in] string defaultName, [in] string directory, [in] string extensions, [in] string caption, [in] [[CAObject]]* callingIdent)
 
* void [[IAdeUICallbacks::FileOpenCompleted|FileOpenCompleted]]([in] string function, [in] string fullFilePath)
 
* void [[IAdeUICallbacks::ShowPdfFile|ShowPdfFile]]([in] string filepath, [in] string bookmark, [in] bool bSearch, [in] bool bBookmarks)
 
* void [[IAdeUICallbacks::OpenURL|OpenURL]]([in] string url, [in] string window, [in] string specs)
 
 
 
= Examples =
 
 
 
 
 
== PHP ==
 
  
 +
<!--T:21-->
 
The attached PHP script:
 
The attached PHP script:
 
#Creates an instance of ADE.
 
#Creates an instance of ADE.
Line 185: Line 47:
 
#Closes the model.
 
#Closes the model.
  
 +
<!--T:22-->
 
  <?php
 
  <?php
 
     $currentPath = getcwd()."\\";
 
     $currentPath = getcwd()."\\";
     $ade = new COM("ADE4.CAEngine") or die("Unable to instantiate ADE");
+
     $ade = new COM("ADE{{#svarget:anamajor|6}}.CAEngine") or die("Unable to instantiate ADE");
 
     echo "ADE successfully loaded.\n";
 
     echo "ADE successfully loaded.\n";
 
     $modelCreated = $ade->CreateModel("MyNewModel");
 
     $modelCreated = $ade->CreateModel("MyNewModel");
Line 208: Line 71:
 
  ?>
 
  ?>
  
= See Also =
+
= See Also = <!--T:23-->
 
 
 
* [[:Category:ADE Classes]]
 
* [[:Category:ADE Classes]]
 
* [[:Category:ADE Methods]]
 
* [[:Category:ADE Methods]]
Line 215: Line 77:
 
* [[Analytica Scripting Guide]]
 
* [[Analytica Scripting Guide]]
  
 
+
<!--T:24-->
==See Also==
 
 
{| style="margin: 1em auto 1em auto;width: 100%;border:0;table-layout: fixed;" cellpadding=5
 
{| style="margin: 1em auto 1em auto;width: 100%;border:0;table-layout: fixed;" cellpadding=5
 
|- style="text-align: center"
 
|- style="text-align: center"
|  [[Working with Models, Modules, and Files in ADE]] <-  ||  [[Analytica Decision Engine (ADE) API | ADE Server Class Reference]] || ->
+
|  [[Working with Models, Modules, and Files in ADE]] <-  ||  [[ADE Server Class Reference]] || -> [[CAEngine]]
 +
</translate>

Latest revision as of 23:22, 26 January 2021



Release:

4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5


Other languages:
English • ‎中文

ADE User Guide >

These are the ADE server classes:

  • CAEngine class contains methods and properties that allow you to open and close existing models, create new models, create new Analytica objects, and access Analytica objects contained in your model. Use of ADE really starts with the creation of a CAEngine object, from which all else flows.
  • CAObject is ADE's wrapper for an Analytica object, such as a variable or module. It provides access the the object's attributes, including its definition and result. It often is used as a stepping stone for obtaining a variable's result table.
  • CATable provides the equivalent of an intelligent array. It is used to wrap an Edit Table, allowing your program to change cell values, or a result array, allowing you to access individual cells, slices, or even a graph image of the result.
  • CAIndex provides information about the index of a CATable.
  • CALicense provides a method for instantiating a CAEngine, and provides details about why such an instantiation failed, which would otherwise not be available if you instantiate the CAEngine directly. It also provides some information about limitations in your license to use ADE.
  • CAPicture holds an in-memory image atom when a result, or the cell of a result, is an image.
  • CAGraphPivot provides information about the current pivot state of a graph, possible next pivots, and allows you to change the pivot of a graph.
  • CAFiller represents a graphing dimension for CAGraphPivot's graphing roles.
  • IAdeUICallbacks is an interface that allows you to implement callbacks that are called when Analytica functions requiring user input are evaluated. You can implement these callbacks to support these user interface interactions in your own application. In many cases, the name of each method corresponds fairly directly with the name of the Analytica function that produces the user interaction. When your application does not implement this interface, most of the functions requiring user interaction will do nothing when evaluated in ADE.
  • IAdeUIWindowCallbacks is an interface which contains the ShowWindow() and CloseWindow() functions, and which is called when sending older typescript "Show windowType obj" and "Close windowType obj" commands. This allows the use of these commands in a more general fashion, including cases where scripts appear in conditionals, in functions, etc. When your application does not implement this interface, these newer functions will do nothing when evaluated in ADE, and the script commands will perform as in earlier releases.


The "IAde" prefix stands for "Interface ADE". Your own code can define a class that subclasses this interface and implements its method, and then pass it to CAEngine::SetCallbackObject.


New to ADE 4.6

Examples

The attached PHP script:

  1. Creates an instance of ADE.
  2. Creates a new model.
  3. Creates a Variable Object.
  4. Modifies the definition of the created Variable to '4+1*7'.
  5. Get the result back from the created object and prints it out.
  6. Saves the created model to a file 'TestModel.ana' in the current directory.
  7. Closes the model.
 <?php
    $currentPath = getcwd()."\\";
    $ade = new COM("ADE6.CAEngine") or die("Unable to instantiate ADE");
    echo "ADE successfully loaded.\n";
    $modelCreated = $ade->CreateModel("MyNewModel");
    if($modelCreated == true){
        echo "Model successfully created.\n";

        $newObject = $ade->CreateObject("MyVariable", "Variable");
        $newObject->SetAttribute("Definition", "4+1*7");

        $result = $newObject->Result();
        echo "The new object's result is: ". $result .".\n";

        $ade->SaveModel($currentPath."TestModel.ana");
        $ade->CloseModel();
        echo "Model succussfully closed.\n\n";
    }
    else{
        echo "Model creation failed.\n\n";
    }
?>

See Also

Working with Models, Modules, and Files in ADE <- ADE Server Class Reference -> CAEngine
Comments


You are not allowed to post comments.