VA FileMan V. 22.0 Getting Started HTML Manual Banner


 

Main Chapter Advanced User Manual Programmer Manual

Displaying Information


Search

Introduction

When you print reports, you can print a subset of the total number of file entries, if you sort your output. For example, by sorting on a file's DATE field, you could sort for entries from October 1st to October 15th, and only print entries whose DATE field falls in that sort range.

Selecting a subset of entries by sorting works well if the subset of entries you would like to print can be isolated based on a contiguous sort range. However, what if you would like a different set of entries (e.g., only entries whose DATE field is equal to either September 1st, October 1st, or November 1st)? You cannot do this with a sort range, because the sort range that includes September 1st and November 1st would include every entry between the two dates.

When you use VA FileMan's search capabilities, you have much more control over what entries you select from a file for printing.


How to Search

As with VA FileMan's print capabilities, there are two methods in which you can use VA FileMan's search features:

In either case, use of VA FileMan's search features is very similar. In most cases, the only difference is that with the Search File Entries option, you have to choose which file to search.

The steps in searching are:

  1. Enter the search conditions (truth tests) to perform on each entry.

  2. Specify how the search conditions should be combined (link them together with logical ANDs & ORs) to select records.

  3. Format your output (i.e., choose the sort order and print fields).


Search Steps

1. Enter Conditions

First, you must enter one or more search conditions to test each entry. For each condition you choose a field in the entry and a condition to compare the field against.

For example, you could check if an entry's DATE field is NULL, GREATER THAN 10/1/96, or EQUALS 10/1/96.

Search Condition Tests

The following table lists the six possible search conditions against which you can test entries. It also includes the symbol that represents the condition (if any), for what field types the condition can be used, and the description/arguments of each condition:

Condition Symbol For Field Types Description/Arguments
NULL (none) All except WORD-PROCESSING. NULL returns true if the field in question is empty (null). No argument is required.
CONTAINS [ NUMERIC, FREE TEXT, WORD-PROCESSING, MUMPS, SET OF CODES, and COMPUTED fields. Enter a character string that should be contained in matching entry fields.
MATCHES (none) NUMERIC, FREE TEXT, MUMPS, COMPUTED, and DATE/TIME fields. Enter a MUMPS pattern match. The pattern must be valid for the MUMPS pattern match operator.
LESS THAN < NUMERIC, COMPUTED, SET OF CODES, FREE TEXT, and DATE/TIME fields. Enter a value that a matching entry field should be less than. Non-NUMERIC fields are evaluated as if they were numbers. Thus, strings beginning with alpha characters are evaluated as zero.
EQUALS = All data except WORD-PROCESSING. Enter a value to which a matching entry field should be equal.
GREATER THAN > NUMERIC, COMPUTED, SET OF CODES, FREE TEXT, and DATE/TIME fields. Enter a value to which a matching entry field should be less than. Non-NUMERIC fields are evaluated as if they were numbers. Thus, strings beginning with alpha characters are evaluated as zero.

When you start your search, VA FileMan asks you to enter a field, a condition, and a value to which the field is compared.

For example, to create a search condition that would find all entries whose DATE ACCESS CODE LAST CHANGED field contains a date older than 120 days in the past, you would enter the following:

-A- SEARCH FOR FIELD: DATE ACCESS CODE LAST CHANGED
   -A- CONDITION: LESS THAN
   -A- GREATER THAN: T-120   (Jun 20, 1995)

NOTE: Each prompt above begins with "-A-"; what you've entered becomes search condition "A."

Once you enter your first search condition, you can enter additional search conditions, if you wish. VA FileMan assigns the letter "A" to the first search condition, "B" to the second search condition (if any), "C" to the third, and so on..

Here is an example of entering two truth tests:

-A- SEARCH FOR FIELD: DATE ACCESS CODE LAST CHANGED
   -A- CONDITION: LESS THAN
   -A- GREATER THAN: T-120   (Jun 20, 1995)

  -B- SEARCH FOR FIELD: ACCESS CODE
  -B- CONDITION: 'NULL 

  -C- SEARCH FOR FIELD: 


2. Combine Conditions

After defining a series of conditions (A, B, etc.), you combine the conditions to yield the complete test that an entry must satisfy to be selected in the search. The complete test is a logical combination of tests A, B, etc., using AND, OR, and NOT.

Operators for Combining Search Conditions

The following table lists the possible operators to combine search conditions:

Condition Symbol Description Example
AND & For truth test to be true, the conditions on both sides of the AND operator must be true. The "&" symbol can be omitted (i.e., AB is the same as A&B). A&B
NOT ' or - For truth test to be true, the condition following NOT (i.e., apostrophe, "'" or dash "-") must be false. If A is false, 'A evaluates to true. 'A
OR Enter on new line. For truth test to be true, only one of the conditions that are combined with OR needs to be true. If A is true and B is false, A OR B evaluates to true.
IF: A 
OR: B 

For example, if you just want to find all entries for which search condition A is true, you would enter:

  -B- SEARCH FOR FIELD: 
   IF: A
   OR: 

A more complicated search might have a number of search conditions (e.g., A, B, C, and D). Thus, for example, to find all entries which either: 1) satisfy both truth tests A and B, or 2) do not satisfy truth test C, but satisfy truth test D, you could combine search conditions as follows:

  -E- SEARCH FOR FIELD: 
   IF: A&B
   OR: 'C&D
   OR: 

In the example above, the logic says "if A and B, or if not C (but D)".


3. Format Output

The remaining steps to finish your search are to choose your sorting criteria (same as with printing) and to choose the fields to print for each matched entry (also the same as with the printing).

A complete search (entering search conditions, combining search conditions, and finishing the search) is shown below:

Example of a Completed Search.

The previous search found two entries that matched the search conditions (i.e., DATE ACCESS CODE LAST CHANGED greater than 2/2/99 and ACCESS CODE not null).


Details and Features

Sorting and Searching

As you may recall from the "How to Print Reports from Files" chapter in this manual, you can print a subset of entries from a file by sorting (i.e., printing only those entries that fall between a sort-from value and a sort-to value). Searches also select a subset of entries from a file, although with more flexibility than with sorting.

When you print your output from a search, you are also given a chance to sort the output. This means that while searching selects a subset of entries to print, through sorting you can further restrict that subset of entries that is going to print. How does sorting affect the output of the searches?

The answer is that VA FileMan uses both your search and sort order to select entries. You enter the search criteria before you enter the sort order. However, the selection of entries indicated in the sort ("START WITH … GO TO" dialogue) sorting is done first, after which the search conditions are applied to all remaining entries to determine the final set of matching entries.


SEARCH Templates

You can save the results of your search in a SEARCH template. Doing this allows you to:

This is because SEARCH templates store both your search criteria and also the list of entries that is found in your search.

Creating SEARCH Templates

The place to save your search criteria and results in a SEARCH template is right after you specify your search conditions. At this point, you are prompted:

  STORE RESULTS OF SEARCH IN TEMPLATE:

You can create a template at this prompt. Because SEARCH templates are stored in the same file as SORT templates (the SORT TEMPLATE file, #.401), you can't give a SEARCH template the same name as a SORT template. To avoid creating a SEARCH template, just press the Enter/Return key at this prompt. Usually, only the creator of a SEARCH template can use it.

Reusing Search Criteria Stored in a SEARCH Template

Whenever you do a search, you can reuse the search criteria (i.e., your combined search conditions) stored in a SEARCH template. To do this, enter the bracketed SEARCH template name at the first "SEARCH FOR FIELD:" prompt:

  -A- SEARCH FOR FIELD: [RESEARCH 1]

A new search will be performed with the recalled search criteria.

Reusing Search Results in Another Search

Whenever you do a search, you can recall the results of a previous search (the list of entries found in the search) at the "SORT BY:" prompt. In this case, the new search is done against the entries in the SEARCH template, rather than the entire file. Answer the "SORT BY:" prompt with the bracketed SEARCH template name:

  SORT BY:  NAME// [RESEARCH 1]

Reusing Search Results in a Print

When doing VA FileMan prints, you can also recall the results of a previous search at the "SORT BY:" prompt. In this case, the entries saved in the SEARCH template are the ones printed in the report. This is handy if you do a search, collect a group of entries, and then want to print several different reports based on the same set of entries.


Internal vs. External Field Values for Search Conditions


Print Number of Matches Found

If you only want to print the number of matches found, without printing any of the matched entries, answer the "FIRST PRINT FIELD:" prompt by simply pressing the Enter/Return key.


Searching Multiples

Searching on multiple-valued fields, like the DIAGNOSIS field in the PATIENT file, is a special situation. You must specify whether a truth test is to be considered met if at least one of the subentries for an entry passes the test or if all the subentries must pass the test.

When truth tests contain a negative (contains an apostrophe "'"), you can even specify that an entry with no subentries should automatically pass the test.

Suppose, for example, that you want to search for all patients who were born before 1900 and who don't have a DIAGNOSIS containing the word ANGINA:

Example of Searching Multiples Using Truth Tests.

Another ambiguity about searches of multiple fields is how to interpret two separate truth tests on the same subfield.

For example, if you are searching for DIAGNOSIS containing ANGINA and also for DIAGNOSIS containing PECTORIS, do you want to find:

Whenever you combine two truth tests (e.g., A and B) pertaining to the same multiple-valued field, you are prompted with the following:

CONDITION -A- WILL APPLY TO THE SAME MULTIPLE AS CONDITION -B-   
OK? YES//

In this example, a YES answer means that ANGINA and PECTORIS must be found in the same DIAGNOSIS. If you answer NO, you can specify how A and B will apply:

DO YOU WANT THIS SEARCH SPECIFICATION TO BE CONSIDERED TRUE FOR CONDITION -A-
 
        1) WHEN AT LEAST ONE OF THE 'DIAGNOSIS' MULTIPLES SATISFIES IT
 
        2) WHEN ALL OF THE 'DIAGNOSIS' MULTIPLES SATISFY IT
 
    CHOOSE 1-2: 1// 2

DO YOU WANT THIS SEARCH SPECIFICATION TO BE CONSIDERED TRUE FOR CONDITION -B-

        1) WHEN AT LEAST ONE OF THE 'DIAGNOSIS' MULTIPLES SATISFIES IT
  
        2) WHEN ALL OF THE 'DIAGNOSIS' MULTIPLES SATISFY IT
 
    CHOOSE 1-2: 1// 
 

In this case, all the diagnoses would need to satisfy the A condition, but only one (or more) would need to satisfy the B condition.

NOTE: Applying search tests to fields in a multiple selects entries at the top level of the file. VA FileMan's searching features cannot be used to select specific subentries.

 


Reviewed/Updated: March 4, 2007