DBUW Dla Windows
https://ftp.tres.pl/dodatki-windows dbuw
DBUX Dla Linux
https://ftp.tres.pl/dodatki-linux dbux
0. Zastrzeżenia dotyczące zmian w bazie danych
1. DBU. Rady praktyczne
2. Użytkowanie programu DBU
3. Inne programy czytające DBF
Zmiana typu pola danych.
0. Zbior należy skopiować przed edycją, aby go odzyskać w przypadku
niepowodzenia
1. Dodać pole o docelowym typie do struktury
F3 Create > Database
Dopisac nowe pole > Insert albo przejść na koniec
Podać nazwe pola, typ, rozmiar
F4 Save > Struct
Bez zmiany nazw pól !
2. Przepisanie zawartości pola o pierwotnym typie do docelowego
F6 Utility > Replace
field: dodane pole
with: wyrażenie konwersji zależne od typów
2.1 Konwersja liczby (N) na date (D)
np. pole N_DNI do pola DATA, gdzie N_DNI zawiera ilość dni od dnia
28.12.1800
field: DATA
with: ctod('1800.12.28') + N_DNI
2.2 Konwersja daty (D) na liczbę (N)
np. wypełnienie pola ILDNI ilością dni od powstania dokumentu DATA do
terminu zapłaty TERMIN
field: ILDNI
with: DATA - TERMIN
lub np. ilość dni od 28.12.1800
field: ILDNI
with: DATA - ctod('1800.12.28')
2.3 Zamiana liczby (N) na tekst (C)
np. zapisanie numeru dokumentu z pola N_ID (N) w polu NUMER (C)
field: NUMER
with: str(N_ID, 12, 0)
2.4 Zamiana tekstu (C) na liczbę (N)
Pole tekstowe musi zawierać wyłącznie cyfry.
Np. zamiana NUMER (C) do N_ID (N)
field: N_ID
with: val(NUMER)
2.5 Zamiana daty (D) na tekst (C)
np. zapisanie pola TRDATE (D) w polu C_DATA (C 10)
field: C_DATA
with: dtoc(TRDATE)
jeżeli pole data jest 8 znakowe, to trzeba pominąć dwie cyfry roku
field: C_DATA
with: right( dtoc(TRDATE), 8 )
2.6 Zamiana tekstu (C) na date (D)
np. zamiana pola C_DATA (C) na pole D_DATA (D)
data zapisana jest z separatorami miesięcy i dni.
field: D_DATA
with: ctod(C_DATA)
jeżeli data w formacie bez separatorów: RRRRMMDD
field: D_DATA
with: stod(C_DATA)
2. Użytkowanie programu DBU
DBU syntax:
DBU [<dbfFile>|<viewFile>] [/C|/M] [/E]
<dbfFile> DBF file to browse/edit
<viewFile> DBU View file to use
/C Color display mode (default)
/M Monochrome display mode
/E Open all files in exclusive
(non-shared) mode
The main screen shows up columns, each of
which represents a select area. One unused column is
visible unless all six are being used. Each active
column contains the name of a data file, a list of open
index files, and an active fields list. The items on
this screen together with relations and filters make up
the current View which affects all system operations.
The View can be saved in a disk file and restored at a
later time.
When the cursor is in the unused column, it cannot
be moved down to indexes or fields and operations that
require an open data file cannot be performed. However,
other operations like opening a data file and creating a
new data file are allowed. This is because the system
uses the current cursor position to make decisions like
which data file to copy or index or which data structure
to modify (select Create Database with the cursor in an
active column to modify a structure). The affected View
item remains highlighted while a pop-up window provides
the necessary interface for the task at hand. The Esc
key can always be used to return to the previous level.
Esc is also used to exit the program.
Items may be added, changed, or deleted in one of
three ways: 1) Just start typing 2) Press a command
key (Enter, Ins, or Del) 3) Press a function key to
activate the pull-down menus. Ins and Del will cause a
shift to make room or close a gap, while Enter will just
replace. The menus are always available, but not all
menu items will be selectable at all times. A light bar
indicates the current item, while other items on the
list will appear as bold (currently selectable) or
normal (currently unselectable). If no item is
currently selectable, no light bar will appear and no
selection may be made from that menu. To select, press
the Enter key or press the same function key again.
Fields box
The fields lists only affect Browse mode. Selected
fields will appear on the Browse screen in the same
order that they appear on the main view screen. When
Browsing the entire View, selected fields from all open
files will appear side by side in the same order that
they appear on the main view screen. The fields from
each file must remain grouped together. A field from
another select area cannot be entered into the current
list. No complex or composite expressions are allowed.
To copy selected fields from a data file, modify
the structure, save it under a different name, and then
append from the original file.
Browse
Browse allows full-screen editing of data from one
data file or from the entire View. When Browsing the
entire View, relationships should be established between
the data files so that related records will be displayed
side by side. When the cursor is moved onto a field
that belongs to a different data file, the status line
will change to indicate the current status of that file.
Use the cursor keys and Ctrl-cursor keys to move
about the screen (both horizontal and vertical scrolling
are supported). Search functions are available from the
Move menu to improve mobility.
To edit a field, either press Enter or just start
typing. A blinking cursor will appear to indicate that
data entry is taking place. Data is actually being
entered into a temporary variable and the data file will
not be altered until the entry is completed (this is
true for memo fields as well). Except for memo fields,
the up and down arrows have been set to complete the
entry and then move the cursor either up or down.
To delete a record, press the Del key. To recall
a record (un-delete), press the Del key again. The file
can be packed later from the Utility menu.
To append a new record, move the cursor to the end
of file and press the down arrow (Ctrl-PgDn will move
directly to the end of file). A blank template for a
new record will appear and the '<new>' indicator will be
displayed next to the word 'Record', but a new record
will only be appended when actual data has been entered
into any one field of that record. Newly appended
records will remain on the screen (regardless of any
index or filter) until the up arrow, PgUp, Ctrl-PgUp, or
Ctrl-PgDn key has been pressed. Thus, several new
records may be added without refresh. Append mode is
only available when Browse Database has been selected
(not Browse View).
Modi_stru
Create Database will actually read the structure of
the current data file and allow it to be modified. If a
new file is to be created from scratch, the cursor must
be in the unused column of the main view screen before
selecting Create Database.
The structure window is much like the Browse window
with a few exceptions. For one thing, it is a structure
that is being edited and not data from a file. Entering
a field name, length, or decimals works exactly the same
as Browse (press Enter or just start typing) except that
the field name is forced to all caps. The field type
can be changed by typing the first letter of the desired
type or by pressing the space bar until the desired type
appears on the screen. If the type of an existing field
that contains data is changed, the system will fail when
it attempts to preserve that data. To preserve data in
this situation, change the field type (keeping the same
length) and save the structure under a different name.
Then copy the original file in SDF mode and append that
text file (also SDF) to the empty new file with the new
structure. Another difference from Browse is the use of
the Ins and Del keys: The Ins key will open a new line
before the cursor to insert a field and the Del key will
remove the current field from the list. Also, the down
arrow will add a new field to the end of the list.
The Save menu contains the selection to generate a
file structure. When activated, a window will open to
accept a file name. Whether the structure was read from
an existing file or created from scratch, a search will
be made for a file with that name. If the file exists,
an attempt will be made to preserve the data. Normally
this is desirable for structure modification but, if the
intention is to replace the existing file with a totally
new one, it is better to erase the unneeded file first.
If only the name of one or more fields has been changed,
the message 'Change Field Name(s)? (Y/N)' will appear.
Press 'Y' to preserve data from all fields, 'N' to lose
the data from those fields only, or Esc to cancel.
Make_ntx
A data file that is to be indexed must be open in
the current View and the cursor must be in the column of
that file for it to be the file selected to index. The
current index file is the last one that the cursor was
on in the current list (the first one if the cursor was
never there). If the current index file is not blank,
it will be entered as the default, the key will be read
and entered, and the cursor will first appear on 'Ok' so
that a quick re-index may be performed. In fact, any
time an existing index file is entered or selected the
key will be read automatically (unless it has already
been entered). The newly created index file will remain
open and become part of the current View.
Open database
A database file may be opened by using a files box,
or by just typing the name into the space on the screen.
The files box may be opened by selecting 'Database' from
the 'Open' menu, or by pressing Insert or Enter. Enter
or just typing in the name will cause the current data
file to be closed before another one is opened in its
place. Pressing Insert or selecting from the pull-down
menu will cause all open files in work areas equal to or
greater than the current area to be shifted to a higher
area before another file is opened, thus preventing any
file from being closed. All indexes, filters, etc. will
be moved with the data files. A file may be closed by
pressing Delete while the cursor is on the filename.
Filters
One filter condition may be entered for each open
data file. Any logical expression that is valid as seen
from the current work area will be accepted. A blank
expression will remove the filter condition for the data
file in the current work area. Fields from other files
that are linked to the current data file by means of
relations may be included in the expression if the alias
is specified (e.g. alias->fieldname). Examples of valid
logical expressions might include the following:
LAST_NAME = 'JONES'
AMOUNT > 0
EMPLOYEE->SALARY >= 1000.00
Open index
An index file may be opened by using a files box,
or by just typing the name into the space on the screen.
The files box may be opened by selecting 'Index' from
the 'Open' menu, or by pressing Insert or Enter. Enter
or just typing in the name will cause the current index
file to be closed before another one is opened in its
place. Pressing Insert or selecting from the pull-down
menu will cause all open index files in the current work
area to be shifted before another file is opened, thus
preventing any file from being closed. An index may be
closed by pressing Delete while the cursor is on the
filename.
Get_relation
Each relationship is displayed on two rows. The
first row shows the names of the two related files with
an arrow connecting them. Both files must be open in
the current View and can only be related left to right
with the parent file on the left and the child on the
right. The second row shows the key expression. Up to
15 relations may be entered. If a file is the parent of
more than one relationship, a multi-child relation will
be established.
Use the cursor keys to select a vertical position
in the list. The order that relations are entered is
not important, but the list is contiguous and the cursor
cannot be moved beyond the first blank entry. To enter
a relation, press Enter or Ins or type the first letter
in the name of an open file. Using the Enter key will
cause the parent, child, and key to default to their
previous values (this allows quick changes). Otherwise,
a new relation will be inserted before the cursor. Use
the Del key to remove a relation from the list. In any
case, a file name will be displayed in bold text which
will represent the parent of the relationship. Use the
left and right arrow keys until the desired parent file
appears on the screen and then press Enter. A visual
arrow will appear connecting to the next file name to
the right which now appears in bold text as well. Again
use the left and right arrows (or press a letter key)
until the desired child appears at the end of the arrow
and then press Enter again. The two file names will
change to reverse video (indicating the selected parent
and child) and an entry field will appear on the next
row. Type in the key to the relationship according to
the rules of SET RELATION. If the key is left blank or
if the Esc key is pressed at any time, the operation
will be aborted and the relation will not be set.
Logical expression for LOCATE
Enter any logical expression that is valid as seen
from the current work area (if the entire View is being
Browsed, the current work area is 1 even if the cursor
is currently on another file). Fields from other files
that are linked to the current data file by means of
relations may be included in the expression if the alias
is specified (e.g. alias->fieldname). Examples of valid
logical expressions might include the following:
LAST_NAME = 'JONES'
AMOUNT > 0
EMPLOYEE->SALARY >= 1000.00
Sdf, delimited
SDF and DELIMITED are alternate modes of operation
that import and export data in the form of text files.
Press the Enter key to toggle one of these modes on or
off (both cannot be selected at the same time). When
one of these modes is selected, the default extension
will change from .DBF to .TXT, the files list to the
right will change to *.TXT files, and the screen display
will indicate the new mode of operation. If the mode is
then toggled off, everything will revert back to normal.
Copy
Copy cannot be selected unless the cursor is in an
active column of the main view screen because an open
data file is needed as the source of the operation. The
target file is normally another data file unless one of
the optional modes is selected (SDF or DELIMITED) which
create a text file. A subset of data may be copied by
setting a filter and/or entering any combination of FOR
and WHILE expressions and/or a SCOPE. Records will be
coppied beginning at the top unless a SCOPE or WHILE
expression is specified in which case the operation will
begin with the current record. The file will be coppied
in indexed order if one is open. A FIELDS clause cannot
be specified; all fields will always be coppied.
Seek expression
Enter a search term that can be evaluated from the
controlling index key in the current work area (if the
entire View is being Browsed, the current work area is 1
even if the cursor is currently on another file). A
substring is sometimes sufficient for character indexes.
For example, if the current data file is indexed on
LAST_NAME + FIRST_NAME, and if the length of LAST_NAME
is 15, a valid search term might be JONES TOM.
Notice that the correct number of spaces are needed to
to seek a specific record. However, if just JONES or
even JON is entered, a nearby record will be found (like
JONES ALBERT) and TOM will be easy to find. Do
not use quotes when seeking a character expression.
Goto record number
Enter the desired record number as a numeric value.
The record pointer of the current data file will be set
to that number unless it is out of range. If the entire
View is being Browsed, the record pointer of the primary
data file (the one open in work area 1) will be set to
the requested number even if the cursor is currently on
another file. This is necessary because moving the
record pointer of a secondary file will temporarily
disturb the relationship. If the cursor is not on the
primary file, the record number displayed on the status
line will be the one that is related to the requested
record in the primary.
Append
Append cannot be selected unless the cursor is in
an active column of the main view screen because an open
data file is needed as the target of the operation. The
source file is normally another data file with a similar
structure unless one of the optional modes is selected
(SDF or DELIMITED) in which case the source must be a
text file. The selected source file will be appended to
the end of the current data file in record number order
even if the file is currently open in another work area
with an open index. Index files in the current select
area, however, will be updated to include the new data.
A subset of source data may be appended by entering any
combination of FOR and WHILE expressions and/or a SCOPE.
For, while
FOR and WHILE expressions are used to extract a
subset of data from a file. A FOR expression will be
evaluated as each new record is considered, and those
records that evaluate false will not be processed. A
WHILE expression causes processing to begin with the
current record and continue only while the condition
evaluates true (WHILE .T. can be used to process the
rest of the file). If both FOR and WHILE expressions
are entered, WHILE takes precedence over FOR. Character
strings should be enclosed in quotes. For example,
LAST_NAME = 'JONES' might be a valid FOR or WHILE
expression.
Scope
The Scope can either be ALL records or a specific
number of records. To specify ALL, type in a value of
zero or press a character key (ALL is the default). If
any other number is entered, ALL will be replaced by the
word NEXT followed by the value entered. The operation
will begin with the current record and continue until
the requested number of records have been processed or
until the end of file is encountered.
Run a program or enter SO command
Enter the name of a program or a SO command just
as if the SO prompt were on the screen. The same keys
used for field editing are available to edit the current
command line. Press the Enter key to begin execution of
the program or command. Press Esc to return to the main
View screen. There must be enough free memory to allow
the program to run properly. Use caution when acting on
files that are open in the current View.
Memoedit sceen
Memo fields are edited in a pop-up window. Use the
cursor keys and Ctrl-cursor keys to move around within
this window. Other active keys are defined as follows:
Ins.........................toggle insert mode
Ctrl-N.............................insert line
Ctrl-B........................reform paragraph
Del..............delete character under cursor
Backspace................delete character left
Ctrl-T.......................delete word right
Ctrl-Y.....................delete current line
Ctrl-W...................exit and save changes
Esc...................exit and discard changes
Skip <n> records
Enter the desired skip value (plus or minus). The
record pointer of the current data file will be moved
forward or back that number of records. If the entire
View is being Browsed, the record pointer of the primary
data file (the one open in work area 1) will be moved
the requested number even if the cursor is currently on
another file. This is necessary because moving the
record pointer of a secondary file will temporarily
disturb the relationship. If the cursor is not on the
primary file, the record number displayed on the status
line will be the one that is related to the requested
record in the primary.
Save, restore view
The current View consists of the open database and
index files, the active fields lists, a filter for each
work area, and a maximum of fifteen relations (multiple
child relations are supported). Simple or complex, the
current View may be saved in a .VEW file from which this
same configuration can be easily restored at a later
time. To save the current View, select 'View' from the
'Save' menu. A box will open to accept the entry of a
filename. The default extension is .VEW, and a default
name will be derived from the primary database. Select
'View' from the 'Open' menu to restore this same 'setup'
of files, fields, filters, and relations.
Replace
Data can be replaced one field per operation. With
the use of the FOR, WHILE, and SCOPE options, any subset
of records can be replaced (the default is all records).
The replacement expression must evaluate to the same
data type as the field being replaced. To specify a
literal value, use quotes for 'character strings' and
CTOD(' / / ') for dates. Numerics and logicals can
be entered directly. Memo fields cannot be replaced
with a literal value.
End of help text