Part 3: Advanced FeaturesWord ExpressionsThe Find, Words command understands a variety of word expressions, which are combinations of words and parentheses. The simplest word expression is a list of words to be looked up, as in this command:
In a list of words like this, Softfile finds the records which contain all the words. Three words have a special meaning: AND, OR, and NOT. These words are logical operators, which means they tell Softfile how to combine the results of its word searches. As a consequence of their special role, you cannot search for these three words. Softfile assumes the use of AND between words if it finds no logical operator. So "word expressions" in the preceding example is taken to mean "word and expressions", which says that each selected record must contain both words. The use of AND is optional between words. Also, note that capitalization is ignored in all words, including the logical operators. If you wanted to find records which contain either "word" or "expressions" or both, you would use the command
You can find records which contain "word" but not "expressions" with the command
In each of the examples thus far, Softfile does its search without regard to the results of the preceding search. However, you can also do searches which only look at the records previously selected, if you begin the word expression with AND, OR, or NOT. You might, for example, have found records which contain "word" but not "expressions". Now you see that some of those records contain "expression" (singular, not plural) and you want to exclude them also. Use this command:
The previous results are used as a starting point, but records which contain "expression" are eliminated. In other words, you have narrowed the search. You can also use AND to narrow a search, and OR to expand a search. Often you will want related words with slightly different endings included in a search. The words "expression" and "expressions" are an example. This is easily done: use a question mark after the required portion of the word. For instance:
The question mark is a wildcard, meaning that all words which are the same up to the question mark should be accepted. The wildcard has the same effect as listing the matching words with OR between them:
Wildcard searches make it easy to include many similar words in your search. The search word "list?" will find the words "list", "lists", "listing", "listed". Softfile does the search without showing you the words it found. Sometimes this can lead to words you don't want. In this example, you would also find "listen", which you may not want. In order to see which words are included in a wildcard search, use the Softfile Words command. In this case:
will show you the words which begin with "list" and how many records contain each word. As with arithmetic expressions in most computer languages, Softfile's word expressions are evaluated according to the priority of the logical operators, which can be overridden with parentheses. AND has higher priority than NOT and OR. NOT and OR have the same priority and are evaluated left to right. Parentheses have the highest priority. Let's consider an example given previously. The command
is different from the command
In the first case, Softfile finds two groups of records: those which contain "word" and those with either "expression" or "expressions". Then it selects records in the first group but NOT in the second group. In the second case, Softfile finds records which contain "word", removes records which contain "expression", then adds all records which contain "expressions". The second command includes every record which contains "expressions". It is equivalent to this parenthesized command:
which is the same as this:
Assuming you want to exclude both "expression" and "expressions", you could do that with a wild card and avoid parentheses:
Although word expressions may seem complicated, most searches work as you would expect. For example,
finds records which contain "operating system" (both words) but not "personal computer" (both words). It is equivalent to the parenthesized command
You can use parentheses, as in this example, to group words together to make sure the search does what you want. If a search gets too complex, however, Softfile will not be able to do it in one step and you will get an error message. Softfile does not index every word on every screen. It keeps a list of ignored words, which are never indexed. This list is in a file named "ignore". The words in this list are common words which rarely reveal the content of a screen, such as "the", "this", and "are". If you search for an ignored word, Softfile will tell you the word has been ignored, and the search continues as if the records contain that word. For example, the command
will give the same results as
You would expect each selected record to contain all three words, but "this" is ignored, so the selected records need only contain "computer" and "program". A word which is "not found" is different from a word which is "ignored". Softfile gives a message for each word it doesn't find, which means that the word would be indexed if any screens contained it, but they don't. If any word in a list of words is not found, then the search will find no records. (Recall that a list of words implies AND between the words, so the selected records must contain all the words.) The "ignore" list is in the same directory as the Softfile database. The list contains the words to ignore, one per line. You can customize the list if you wish. Keep in mind that words added to the "ignore" list will only affect records added after the change. To restore consistency to the database, so that ignored words are indeed ignored for all records, use the Softfile Utilities to "index" the database after you change the "ignore" list.
ListsThe Find command selects records from the database. You can save a list of the selected records in a disk file with the List, Write command. Give the list a name up to 8 characters long. Later, you can read this list with the List, Read command. When you read a list, it is as if you had just done a search which selected those records. To look through the records, do View, Selected and use RETURN and ..To see which lists you have saved, do List, Lists. To delete a list, use List, Delete and enter the name of the list. When you write a list of selected records, you are saving a list of the record numbers of the records. You are not saving the records themselves. To see the difference, suppose that you do a word search with the command Find, Words. Do List, Write, test, which saves the list with the name "TEST.LST". Now delete one of the records from the database. This record is gone forever (so be careful you don't delete one you need). The record is not saved in "TEST.LST", but its record number is. Read the list with List, Read, test and step through the records with RETURN. When you get to the record you deleted, you will see an error message which says the record does not exist. What happens is that Softfile reads the list of record numbers, looks for the deleted record, and sees that no record with that number now exists. The purpose of the List command is to allow you to retain the results of a search for later use. Once you have read the list, you can modify it in the usual ways. You can add or delete records: use + to add a record or - to delete a record. You can also use Find, Words to modify the selected records if the word expression begins with AND, OR, or NOT. To keep the changes to a list, you must remember to save the list again. In other words, changes are not made directly to the list in a disk file. You have to read the list, change it, then save it again to get the changes into the disk file.
System CommandsThe command ! lets you execute an operating system command from within Softfile. After you press !, enter a command line and press RETURN. When the command has finished executing, press the SPACE BAR as directed and the Softfile menu will reappear.For example (under MS-DOS), !, dir shows the files in the current directory (which is the directory containing your Softfile database), and !, dir soft.dat shows the size of the Softfile database (excluding the indexes). You should not run the Softfile Utilities program from within Softfile. In other words, do not do this: !, sfutil.
Importing InformationSoftfile can read text from a file and store it in the Softfile database. This is called importing information. The Import command asks for the file name of the text to be imported. It reads the file and attaches the text to the current record on the screen, if any.If the text in the file cannot fit in one record, the usual situation, then additional records are attached to hold the rest of the text. The result of the Import command is that all the text from the file is read into a chain of attached records, and the beginning of the chain is the record which was on the screen when the Import command was given. Softfile makes some adjustments to imported text. If the imported file contains the characters "))" at the beginning of a line, Softfile ignores that line, but the next line begins a new record. In other words, the two closing parentheses can be used to separate records. This is the format which the Output, ..., Disk command normally uses to write Softfile records to disk, so the files created by the Output command can be read by the Import command. Softfile records can also be separated by putting a closing brace, "}", at the beginning of a line. The line containing the brace is stored in the database, whereas a line beginning with "))" separates records but is not stored. Blank lines which would appear at the beginning of a record are ignored. Therefore a long sequence of blank lines in the imported file will not generate blank records in Softfile. The first line of each imported record will have something on it. Finally, Softfile ignores lines which end with two "@" characters. The Uniplex word processor uses such lines to indicate print effects (boldface, underline, etc.) for the preceding line of text. Softfile ignores print effects.
Exporting InformationSoftfile can write records to a disk file with the command Output, ..., Disk. This is known as exporting information. The Output command always writes entire records to the disk file. See the section on "Printing" for details.Softfile has another way to export information, which may be used to extract part of the information from a record. If you set up a form with text boxes, you can export just the information within specified boxes. We will explain how to do this with an example. Suppose we have created a Customer Information form in order to enter the names of business customers. Here is a sample form created for that purpose:
Notice that all the text on the form is preceded with an underline, so the text of the form itself will not be indexed by Softfile. Each time you contact a customer, you can attach a note to the customer's form, so you have a record of all your contacts. If we assign this form a number, with the command Set, Form, Number, each customer record created with the form will also have that form number. Then the command Find, Form will search the database for all the customer information forms. You must save the list of records to be exported:
which writes the record numbers to file CUSTOMER.LST. Softfile can output each field (name, address, etc.) on a separate line, with a blank line between records. In order to do this, you must create a field definition record in your Softfile database. Here is an example, set up to output most of the fields in the Customer Information form:
The field numbers and comments are completely ignored. The field names, however, are used by Softfile to find the fields in each record. For example, the "Name" field is found by searching the record for the word "Name", then taking the value of the name field from the information within the brackets following the word "Name". As noted in the comments on the form , a "+" symbol instead of a field name means that the field is the first one on the next line. In this case it is the second address line, which has no name. The ">" symbol means the field is the next bracketed field on the same line as the previous field. Here the "Phone" field is really just the area code. The next field on the same line is the remainder of the telephone number. Notice that the field definition does not specify the size of each field or even its location in the record. Fields are simply "the information in brackets following the field name". This means that you can rearrange a form without needing to change the field definitions. The layout of the field definition record must be precise. The first field name must appear on the fourth screen line. (The first line is a title, then a blank line, then column titles, then the field names.) The bracket which begins the field name must be in the 11th character position:
11
12345678901
|
Field No. Field Name Comments
[ 1] [Name ] [ ]
Field names in the field definition record must not begin with a blank. If the first character of a field name is blank, Softfile assumes there are no more field names in the definition record. Field names on the form must be followed by a blank. This avoids confusion between words which begin with the same letters. So if the form contains
_Name [ ] then the field definition record should specify "Name", but if the form contains
_Name: [ ] then the field definition record must specify "Name:" (including the colon). A sample field definition record is provided in the sample data, which you should have included when you created your Softfile database. Find it with the command
Once you have a list to specify which records to output, and a field definition record to specify which fields from those records to output, you are ready to export the data. With the field definition on the screen, give the command
and the exported data will be written to file "soft.out". As another example, you might select all records created before January 1, 1988 and save the list in a file OLD.LST:
List, Write, old Softfile automatically makes the list name upper-case and adds the ending ".LST". Get the field definition record on the screen, then do:
The output goes into the file "soft.out", erasing any previous contents of that file.
Sorting RecordsSoftfile does not normally arrange the records you find or export in any particular order. Softfile can, if you wish, sort the records by the values in one or more fields. For example, you can order your customer records by zip code, and for duplicate zip codes, by customer name. The List, Sort command does this.The List, Sort command requires a field definition record with the same format used for List, Export. Here is an example:
Both List, Sort and List, Export need the field definition record to tell them what to do, and they assume the proper field definition record is on the screen when you give the command. Unlike List, Export, however, the List, Sort command does not output the field values to a file. All it does is rearrange the order of the record numbers in the specified list. So to look at the customers in zip code order, you could use these commands (assuming the customer records are form number 20):
List, Write, byzip [get the field definition record on the screen] List, Sort, byzip List, Read, byzip Notice that you must read the list with List, Read to see the records on screen in sorted order. Softfile ignores the difference between upper-case and lower-case letters when it sorts. If you abbreviate the State of California by "CA" in some records and "Ca" in others, they will be treated as equivalent. Similarly, "McDoe" and "MCDOE" are equivalent. Spaces are significant, so "Mc Doe" comes before "McDoe" (because the space character comes before all other characters).
|
Copyright © 1989, 1999 RTG Data Systems
RTG and Softfile are trademarks of RTG Data Systems