ScanAttFromModelFile(filename, attribute)

This extracts the indicated top-level model «attribute» from an Analytica model file. For example, it can be used to peek at the model description attribute, model author, model title, etc.

No changes are made in memory, nothing is loaded, and nothing in the model file is evaluated or executed. The scan of the file stops as soon as the top level attributes are found, and hence is very quick even for extremely large model files.

The file may be in standard Typescript format, in Analytica XML model format, or an obfuscated format.


The function exists primarily for use by programs that use Analytica Decision Engine (ADE) to manage a set of models. For example, when you upload a model file to the Analytica Cloud Player, ACP's directory listing displays the model's title and author, and tooltips show the model description, e.g.:

ACP Directory Listing.png

To generate this listing, ACP needs to peek at the model's top-level attributes. This could be done by opening the model in ADE, but that would involve reading the entire model into memory, parsing the entire thing, and even evaluating index nodes, all of which could take many minutes for certain huge models. By using ScanAttFromModelFile, these attribute values can be retrieved in milliseconds.


Index Attrib := ['Identifier', 'Class', 'Title', 'Description', 'Author'] Do
ScanAttFromModelFile("C:\Program Files\Lumina\Analytica 4.4\Business Examples\Market Model.ana", Attrib) →
ScanAttFromModelFile result.png

ADE Example from C#

 CAEngine ade = new CAEngineClass();
 CAObject obj = ade.Get("Object");      // Any existing object will do
 string expr = "Index Attrib:= ['Identifier', 'Class', 'Title', 'Description', 'Author'] Do ScanAttFromModelFile(filename, Attrib)";
 CATable attVals = obj.CAObject::Evaluate(expr);
 if (ade.ErrorCode != 0) {
   // report error from ade.OutputBuffer
 } else {
   string identifier = attVals.GetDataByLabels("Identifier");
   string title      = attVals.GetDataByLabels("Title");
   string description= attVals.GetDataByLabels("Description");
   string author     = attVals.GetDataByLabels("Author");


Introduced in Analytica 4.4.

See Also


You are not allowed to post comments.