What's new in Analytica 6.4?
New features in release 6.4 (the current release) of Analytica (including ACP and ADE) since the previous Analytica 6.3 release. Analytica normally prompts you to download and install the new release the next time you run it. If not, you can download it from Renew, upgrade or download].
Highlights
- #Choice and MultiChoice now support hierarchical menus and images in menus.
- Identifiers (names) of objects can now be any length, and use non-English characters.
- Long text in tables now word wraps nicely in Analytica (as it already did in ACP).
- Expanded support for binary data for efficient data import, storage, and export, including in-memory binary data ("blobs").
New libraries include:
- #Database library offers a set of functions to make it easier to access databases without having to write SQL. It supports Microsoft Accesss, SQL Server, Maria DB. It uses the new DbConnection function, which speeds up database access by creating a persistent connection used by DBQuery and DBWrite, which previously had to open and close the connection on each use.
- #OpenAI library supports functions to interface with OpenAI's generative models, including ChatGPT 3.5 and 4. The Tutorial on using pre-trained OpenAI language models shows you how to use it, and is a great way to learn how to use LLMs.
- Mutables library helps debugging by saving intermediate values that you can look at to see what was going on inside a calculation.
Extended identifiers
The name or Identifier for a variable or any object can now contain:
- Any number of characters (length was previously limited to 20.)
- Non-English characters ψ, वेग, 角度, размер, etc. (previously allowed in titles but not identifiers).
- Any character, including spaces and parentheses, if you enclose the identifier in backquotes -- e.g. `Emission reduction ($)`
See Identifiers (with Release 6.4 selected) for full details.
You can control the maximum number of characters in identifiers auto-generated from titles to be more than the default 20 in the Preferences dialog.
OpenAI library
Open AI API library offers Analytica functions that interface with OpenAI's generative models. You can leverage the flexibility of large language models (LLMs) to perform tasks that would be hard to do in a formal program or mode. You can choose which model you want to use, including ChatGPT 3.5, ChatGPT 4, and many others. You can generate images from text. Go to the Open AI API library page to download the library. The Tutorial on using pre-trained OpenAI language models shows you how to use it. It's also a great way to learn how to use LLMs.
Database library
The Database library offers functions to make it easy to search, and,update databases, and create, read, modify, and delete database tables, without you having to write SQL. It works with Microsoft Access, Microsoft SQL Server, MariaDB, and PostgreSQL, and can be expanded to support other database platforms.
User interface in tables
- On first-time install, the "Large text in attributes & tables" preference setting now starts out ON.
- Long text in table cells now word wraps in desktop Analytica (as it already did in ACP).
- You can turn word wrap on or off in the cell-formats preference (Alignment tab) -- or as a parameter to CellAlignment.
- The
Hybrid
alignment option in cell formats:- Typically, you usually want numbers right-aligned and text left aligned. This is an example of a hybrid alignment.
- The default alignment now left-aligns single-line text. Formerly it right-aligned single-line text, but left-aligned multi-line text.
- If you really want the old default globally (we doubt you will), then type this in the Typescript window:
- If you only want the old behavior on a single table, just use the Hybrid format in Cell Formats... / Alignment / Horizontal. Set to Hybrid, right align only Single-line text, numbers and dates.
- Added a Flat button style with text for User Input/Output nodes.
- The shortcut/taskbar icon now has white borders, which is clearer on dark/teal backgrounds.
Clicking on nodes
- OnClick differentiates between alias and original.
- Previously, OnClick code couldn't tell whether the user clicked on the original object or on an alias, because Self always refers to the original. Also, the alias can have its own, separate, OnClick which runs first.
- Added two locals that are now available inside the OnClick:
- click_node_obj: Contains the object identifier of the actual node clicked. Use
Handle(click_node_obj)
to get its Handle. - click_continue: By default, the alias's OnClick fires first, then the original's (when both have an OnClick) You can assign false to this to suppress.
Built-in functions
Sequence operator
The behavior of the sequence operator, m .. n
, when m>n
has changed. Of course, we take great care with every new Analytica release to ensure backward compatibility, so your pre-6.4 models will continue to compute the same results when loaded into 6.4. (There is no change whenm≤n
.)
Formerly, the sequence operator gave a decrementing sequence when m>n
. For example
1..0 → [1,0]
{ previous releases }1..0 → [ ]
{ in 6.4 }
That behavior is a common source of bugs. For example, when sequence operator iterates over the positions in a collection, such as in:
With the former decrementing behavior, this expression has a bug when Size(L) is zero. Instead of iterating over no elements, it tried to iterate over the first and zeroth element, neither of which exist. (The zeroth element never exists since positions start at 1). The newer 6.4 behavior corrects this.
A new legacy model preference setting is "m..n decrements when m>n". When you load a legacy model (meaning it was last saved in Analytica 6.3 or earlier), and your model contains at least one m..n
instance where m>n might occur, it sets this preference so that the operator uses the older behavior. It uses a few additional tricks to ensure backward compatibility if you use a legacy library from your non-legacy model, or vice-versa. See Sequence Operator for details. Once you're sure your model doesn't rely on sequences going backwards (which is rare), you should turn off this legacy preference setting.
ReadFromURL
The ReadFromURL function is used for making RESTful web services. Its has been extended to:
- Handle the transfer of binary data
- Support HTTP multi-part message payloads in both directions
- Explicitly control the timeout values, which can be required when calling web services that take a long time to return.
- Access the HTTP status code and text, HTTP response headers, and the content type, all as auxiliary return values.
In-memory binary data manipulation
- Expanded support to manipulate and convert binary data types (aka "blobs"), in Functions: ReadBinaryFile, WriteBinaryFile, GetFromBinaryData, WriteImageFile, and Formatted Text Literals. Added base16-encoded binary data literals, analogous to base64 literals.
- ReadBinaryFile and GetFromBinaryData now also return the offset where the read left off as a 3rd and 2nd return values respectively.
Database functions
You can now speed up database access by opening the connection just once, instead of opening and closing it on each call to DbQuery and DbWrite. The new DbConnection function lets you create a persistent connection, which you can pass as the first parameter to DbQuery or DbWrite.
Parsing
- Added an option to omit Nulls to MakeJSON
- ParseExpression now returns the error message as a second return value (when there is an error).
Choice and MultiChoice
Choice and MultiChoice pulldown menus now support
- Submenus in a multilevel hierarchy.
- «labels» or «selectionLabels» which the user sees in the menu and are different from the index.
- Images in the menu as «labels» or «selectionLabels».
Other new functions
- Added the AbortCalculation function.
Libraries and Example Models
- Added the Mutables library
- Redesigned Intro Diagram.ana. The diagram which opens when you launch Analytica without opening a model.
- Updated the Rent vs Buy model.ana (in the Tutorial models).
Other
- A new bit in Verbosity suppresses the "Mid value is probabilistic. Do you want to view the mid value instead?" messages. We recommend against this, but if you want this, from the Typescript window type:
verbosity : 770
The 6.4.9 Patch release
The 6.4.9 patch release issued in November 2024 replaces the original 6.4.8 release of Analytica. This is a low priority patch, updating to it is optional.
ADE and ACP are unaffected by this patch, and hence retain the original 6.4.8 release.
This patch contains a single enhancement only:
- Less flashing during diagram redraws.
There are no other bug fixes or enhancements in this patch. This flashing during redraws has always been there, and for most models you may barely notice it. The fix is already in Analytica 6.5 beta, but since we encountered an application that is highly impacted by it, we needed the fix before the 6.5 release becomes official.
(If you are reading this in the first half of November 2024 and haven't received notice of the patch, you might be reading it before the patch has been officially posted. In that case, please wait a week or so.).
Enable comment auto-refresher