(Requires Analytica Enterprise, Optimizer, or Power Player)

Returns the contents a text file «filename» as a text value. «filename» may be the name of a file in the Current Data Directory (initially, the directory containing the model), or a path relative to the Current Data Directory , or an absolute pathname.

If it can't find a file with that name, by default, it opens a file browser dialog to let the user select another file. Set optional parameter, «showDialog» to True (1) to show the file browser dialog, using «filename» as default, even if the file exists. Set «showDialog» to False (0) to never show it. If it can't find the file, it shows an error message.

You can specify the caption for the title bar of the file browser dialog titlebar in the optional «title» parameter.

ADE never shows the file browser dialog, no matter what the parameter values.

## Treating End-of-line

There are three common standards in text-files to identify newlines:

• Windows files usually use the two-character sequence CRLF -- Chr(10) Chr(13)
• Unix files use a single LF character -- Chr(10)
• Macintosh OS files use a single CR character -- Chr(13)

Occasional Windows-based programs use one of the other standards.

ReadTextFile insulates you from worrying about which standard is used by converting each to the Unix standard, a single LF -- Chr(10).

If a file contains inconsistent line breaks -- e.g. including more than one examples of LF, CRLF, and CR -- it converts LF and CRLF to a single LF, and leaves CR -- Chr(13) -- as is.

When evaluated in the Analytica Decision Engine (ADE) and a dialog needs to be shown to the end-user, it calls IAdeUICallbacks::GetFilename(...). From within that callback, the parent application can interact with the end-user to resolve the file path, and a web applications can instruct the end-user to upload a file. Once complete, the callback returns the full path to the file which is then read. To receive this callback, the parent application must have previously registered the callback with ADE using CAEngine::SetCallbackObject( ). If it has not registered a callback and the file doesn't exist, returns an empty text.