Opt Net V5
Download Opt_net_v5 Installer (ver. 1.06)
Below is a slightly modified version of the Using_opt_net_v5.txt file that the installation file puts in the Addins_installed folder under the full version of A5v5.
New Option! Added Jan. 20, 2004: This function now optionally removes the .adblock file when running an optimize. The default will automatically remove the file and continue with the optimize. This was chosen as the default because so many users seem to feel that the "lock-out" is not required. By setting the second argument, "Ask_remove_lock", to .T., the function will prompt to remove the lock file or cancel the operation.
There is a lot of detailed information available here for anyone interested in using all the capabilities of this function but using this function is really as easy as:
WHAT THE Opt_net_v5 FUNCTION DOES:
- Installing the Opt_net_v5.aex file to the .../A5v5/Addins_installed folder (this will be done by the installation program),
- Putting the function Opt_net_v5() on a button on the main menu (or other run-on-load form). Perhaps the most important advantage of this feature is that putting the function on a button means the user has no need to access the control panel to run the initial optimize after installing a new application and the user can't chose the wrong button because there is only one.
- Setting the A5 Network Optimize / Update Options as you prefer. Generally they would be set to 'Automatically Update' or 'Ask before updating' but they could also be set to 'Do Nothing' and the Opt_net_v5 routines can be used to provide additional control over automatic updates (see USING THE Opt_v5_check() FUNCTION below), and
- If the only purpose is to allow the initial optimize from a server version, add an OnInit routine to the main menu that hides the button when the database is shadowed. If the button has been named "Optimize_btn", use this script:
Another possibility would be to show the button whenever the .adblock file exists on the server. This would allow the user to force an update if the lock file has been left due to a crash before a previous optimize was completed.
The Opt_net_v5() function starts either a full optimize or a refresh optimize based on whether or not the current application is shadowed. The developer can set up the Opt_net_V5() routine to (a) run from a single button that can be used from both the server and the workstation or (b) force automatic updates or (c) use both the button and automatic updates.
Since the application automatically determines whether it needs to optimize from the server (it's in the master database) or just run a Refresh (it's in a shadowed database), the user doesn't need to determine whether or not the current application is shadowed before running the optimize because the function handles it internally. In fact, the user doesn't even need to know the terms shadowed and optimized.
The routine also copies additional files from the server to the workstation. Under the assumption that all .AEX files and all .AL* files in the application directory are either attached compiled libraries or simple attached libraries required by the application, all of these files are automatically copied to the workstation. In addition, it will copy any additional files listed under the 'Copy additional files...' option in A5 under the Tools / Network Optimize menu.
To install Opt_net_v5() and the supporting functions, simply put the Opt_net_v5.AEX file in the Addins_installed folder below your A5v5 executable files. This folder is typically C:\Program Files\A5v5\Addins_installed.
If you have the installation file (Install_Opt_Net_v5.exe which can be downloaded above) just run the installation file to install it automatically. If both the full version of A5v5 and the runtime are loaded on your computer, the AEX file will be installed to both locations. If the full version of A5v5 is installed, a text file with instructions will be put in the Addins_installed folder and a shortcut will be placed on the desktop for viewing it.
Calling the Opt_net_v5() function by itself will start a network optimize or network refresh as appropriate.
You might want to call the function directly if you wish to make it possible for the user to run updates manually or to run the first optimize without going to the control panel. In this case, simply put the function on a button for the user to run it. The only line of code needed on the button is simply:
USING THE Opt_v5_check() FUNCTION:
This function is used to run a check at start-up to see if there is a need to optimize an existing database - similar to the A5 built-in operation but with added features that some developers may find useful. The difference is that Opt_v5_check() provides additional warnings when version numbers are higher on the local workstation or completely missing on the server. This would help to avoid situations where an old version is accidently put on the server by restoring from on old backup or when an old version was just reinstalled by mistake. To use this function, put Opt_v5_check(1) or Opt_v5_check(2) in the OnActivate event of the first object in the Run-on-Load form and set A5's built-in option to Do Nothing. Using argument 1 will prompt to update and argument 2 will warn and then force an update.
NOTE: The Network Optimize / Update Option must be set to Do Nothing when using Opt_v5_check() or the built-in routines will run before Opt_net_v5.
The addin includes some other functions that may be of interest to some developers. Some of these will return the local or master version information - including the local version in character format for easy display on a form. One of the functions also returns a value that indicates how the workstation version compares to the master version such as decimal lower, integer lower, decimal higher, integer higher and others. To read about these options, see the readme file that is installed with the addin.