Introduction
Have you ever needed to globally replace or delete some data in a DataFlex file? Or, only some of the records based on a selection of some kind? Within some limitations, this program will do all of this, and into the bargain it can be made to use an index to speed up this process.
Do you remember the old DOS "Scope" program from Compuserve? This is a direct descendant of that old program but updated with much newer methods and concepts. All global variables have been replaced with properties and the macros replaced with the newer API calls for obtaining file and index information.
The program uses indirect_file as the means of finding the data to replace, and also for jumping in and out of the indexes.
- Given the proper selection conditions, globally replace data in all records or some records in a DataFlex data file.
- Records may be deleted by entering selection criteria.
- If replacing data, an index may be selected, and the program made to jump in and out of the index.
- Workspaces may be switched as in dbExplorer
- VDF 8 vs all previous versions. The current version will compile and operate under VDF 8 if the "
define VDF8
" line near the top of Global.src is uncommented. You would have to create a workspace as normal.
Source files
GLOBAL.SRC | Main program source |
GLBMENU.MN | Menu |
GLOBAL.VW | Main view |
GLBINDEXENTRY.DG | Index entry dialog |
Lists
GLBFILELIST.DG | Data files |
GLBFIELDLIST.DG | Data fields |
GLBINDEXLIST.DG | Indexes |
Help
GLBHELP.TXT | Help text file |
Environment
A standard workspace will work nicely for this application, create one with dbBldr and unzip using the paths in the zip file. The help text file is located during operation by finding the current workspace help directory.
All of the above source files are IDE compatible
The entire application is IDE compatible with one exception. The menu that the IDE normally places into the .src file is not really applicable to this application since it isn't data aware as the normal application is. For that reason you will need to register the menu file with the IDE if you want to modify the program code.
Below is an example of how you could relocate Data Access Worldwide to New York by using this software
Data Replace Operation
- Enter a file name, use F4 or the prompt button to fill in the file name.
- Enter the "Selection" by pressing F4 to select the File.Field, and add on the limitations if any.
For example:
All records:
file.recnum>0
A record selection:
file.field1="abc"
-or-
file.field1="abc" AND file.field2="DEF"
-or-
file.field1="abc" OR file.field2="DEF"
The standard DF "Eval" function has been used, so most
simple logic can be handled. Multiple selections from
the list will concatinate rather than overwrite, all
you need to do is manually enter the operators and data.
- Select the Field to be changed
- Enter the data to be entered into the field in #3. You may also enter an expression here such as the following:
"ABCD"
24.50
(FILE.FIELD1+3)
(FILE.FIELD1+FILE.FIELD9) Assuming both are numbers
and so forth. Be sure strings and dates are enclosed in quotes.
- Select an index if desired (see section below) and click the "Replace" button.
Data Delete Operation
Follow steps #1 & 2 only.
Deleting does not use indexes, so don't bother.
Indexes
Click on the index button.
Select an index using the popup.
Enter jump-in data. This data assumes the first segment of the above index will be the field used for this. Do NOT enclose any data in quotes for index jumping, in or out.
If desired, enter jump-out data. Again, this data assumes
the first segment of the above index will be the field used
for this.
Click OK.
To use indexes successfully you need to plan a bit. For small
data files, don't bother and just use the recnum. If using an
index, plan the jump-in data for just before the data you want
to change, and the jump-out for just after.
If you click on "Cancel" the index entries will NOT be used.
This application uses a number of useful techniques that aren't ordinarily found in the standard DF application. Some of these are indirect file handling, the Eval function, and a lot of manipulation of file and field attribute information. Since the application isn't data aware, all of the lookup lists have been manually created from the list class.
Download
August 29, 2009
Global Data Change VDF 15 release
Update to VDF 15, though it should work nicely with VDF 14. Change all Recnum references to the primary index of the table being updated. Bug fix for index "jump in."
March 19, 2007
Global Data Change VDF 12 release
This verson of Global has been designed for VDF 12 and later. All of the Studio tags have been removed and the workspace code changed specifically for 12. Parts of the code have been rewritten to take advantage of newer technologies, such as using the array datatype for multidimentional arrays, the workspace selector, cRegistry class and html help.
History
June 27th 2004
GlobalDataChange 1.2 release and read the readme.txt file. The application is IDE compliant.
August 1 2002,
Updated to support VDF8 and some SQL engines
GlobalDataChange 1.1 release and read the readme.txt file. The application is IDE compliant.
July 25 2002,
Updated to support repetitive execution without having to reload the program
GlobalDataChange.zip 1.0 release