ADE Server Class Reference
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.
CAEngine
Creation
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.
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.
See CAEngine for language-specific details.
Properties
- {get,put} string Command
- {get,put} CAObject CurrentModule
- {get,put} CARenderingStyle DefaultDefTableRenderingStyle
- {get,put} CARenderingStyle DefaultRenderingStyle
- {get,put} long DefaultEvaluationTimeLimit
- {get} short int ErrorCode
- {get} string ErrorText
- {get,put} unsigned long Flags
- {get} string Log
- {get} string OutputBuffer
- {get,put} bool Photo
Methods
- string AddModule(string filePath,bool Merge)
- bool CloseModel()
- CAObject CreateObject(string objName, string objType)
- bool CreateModel(string newModelName)
- bool DeleteObject( CAObject aObject )
- CAObject Get(string objName)
- CAObject GetObjectByName(string objName)
- bool MonitorProcess(long pid)
- string OpenModel(string filepath)
- bool ReadScript(string filePath)
- void ResetError()
- bool SaveModel(string filePath)
- bool SaveModuleFile(string moduleName, string filePath)
- bool Send()
- bool SendCommand(string command)
- bool SetCallbackObject(IUnknown* pObj)
CAObject
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).
Properties
- {get,put} string ClassType
- {get} short int DefinitionType
- {get,put} long MethodEvaluationTimeLimit
- {get,put} string Name
- {get,put} CARenderingStyle RenderingStyle
- {get,put} short int ResultType
Methods
- bool CreateDefTable(SAFEARRAY indexArray)
- CATable DefTable()
- CATable Evaluate(string expression)
- variant GetAttribute(string attName)
- bool PictureToFile(string fileName, string mimeType)
- bool PictureToStream(IStream stream, string mimeType)
- variant Result()
- CATable ResultTable()
- bool SetAttribute(string attName, variant attValue)
CATable
Creation
Properties
- {get,put} int GraphHeight
- {get,put} int GraphWidth
- {get,put} bool GraphWithStoredPivot
- {get} variant IndexNames
- {get,put} string Name
- {get} short int NumDims
- {get,put} CARenderingStyle RenderingStyle
- {get,put} short int ResultType
- {get,put} string TableType
Methods
- variant AtomicValue()
- variant GetDataByElements(variant indexPtrs)
- variant GetDataByLabels(variant indexLabels)
- CAIndex GetIndexObject(string indexName)
- variant GetSafeArray()
- bool GraphToFile(string fileName, string mimeType)
- bool GraphToStream(IStream stream, string mimeType)
- string IndexName(short int indexNum)
- bool ObtainTable()
- bool PutSafeArray(variant theVal)
- bool SetDataByElements(variant elementValue, variant indexPtrs)
- bool SetDataByLabels(variant elementValue, variant indexLabels)
- bool SetIndexOrder(SAFEARRAY<string> indexArray)
- CATable Slice(CAIndex index, int i)
- CATable Subscript(CAIndex index, variant label)
- bool Update()
CAIndex
Creation
Properties
- {get} long IndexElements
- {get,put} string Name
- {get,put} CARenderingStyle RenderingStyle
Methods
- long GetNumberByValue(variant val)
- variant GetValueByNumber(long i)
- bool ObtainIndex(string indName)
CARenderingStyle
Creation
Properties
- {get,put} bool FullPrecision
- {get,put} bool GeneralExpression
- {get,put} short HandleFormat
- {get,put} bool NewLineAsCRLF
- {get,put} variant NullValue
- {get,put} bool NumberAsText
- {get,put} bool ReferenceAsText
- {get,put} long SafeArrayLowerBound
- {get,put} short StringQuotes
- {get,put} variant UndefValue
- {get,put} short VarTermFormat
Methods
none
CALicense
Creation
Properties
- {get} long AvailableLicenseInstances
- {get} bool CanUseOptimizer
- {get} short int ErrorCode
- {get} string ErrorText
- {get} long MaxLicenseInstances
- {get} string RlmHostId
- {get} string RlmPath
- {get} string RlmUserId
Methods
- CAEngine NewCAEngine()
- void SetApplicationLicenseCode(string)
IAdeUICallbacks
New to 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.
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 MsgBox([in] string title, [in] string text, [in] long buttons)
- bool ShowProgressBar([in] string title, [in] string text, [in] double p)
- void HideProgressBar()
- string AskMsgText([in] string question, [in] string title, [in] long maxText, [in] string defaultText, [in] bool bPassword, [out] bool* bCancel)
- double AskMsgNumber([in] string question, [in] BSTR title, [in] bool bShowDefault, [in] double defaultNumber, [out] bool* bCancel)
- long AskMsgChoice(([in] string question, [in] BSTR title, [in] array<string> optionList, [in] long defaultPosition, [in] bool bShowAll, [out] bool* bCancel)
- string AskMsgComboBox([in] string question, [in] string title, [in] array<string> optionList, [in] string defaultText, [in] bool bShowAll, [out] bool* bCancel)
- string GetFilename([in] string function, [in] string defaultName, [in] string directory, [in] string extensions, [in] string caption, [in] CAObject* callingIdent)
- void FileOpenCompleted([in] string function, [in] string fullFilePath)
- void ShowPdfFile([in] string filepath, [in] string bookmark, [in] bool bSearch, [in] bool bBookmarks)
- void OpenURL([in] string url, [in] string window, [in] string specs)
Examples
PHP
The attached PHP script:
- Creates an instance of ADE.
- Creates a new model.
- Creates a Variable Object.
- Modifies the definition of the created Variable to '4+1*7'.
- Get the result back from the created object and prints it out.
- Saves the created model to a file 'TestModel.ana' in the current directory.
- Closes the model.
<?php $currentPath = getcwd()."\\"; $ade = new COM("ADE4.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
See Also
Working with Models, Modules, and Files in ADE <- | ADE Server Class Reference | -> |
Enable comment auto-refresher