VA FileMan V. 22 Key and Index Tutorial
[<-- Previous Lesson]   Lesson 3 Quiz Button   [Next Lesson -->]

Part 1 - Regular Indexes


Lesson 3. VA FileMan Lookups Using Compound Indexes

In this lesson you will see how your Regular index affects the behavior of the lookup utility IX^DIC. You will also change the collation and lookup prompt for the DOB field in your "C" index. The following topics are covered with exercises following each:

1.  Interactive Lookups Using Compound Indexes.
2.  Passing Lookup Values for Lookups Using Compound Indexes.
3.  Collation Property and Lookup Prompt Property.


Interactive Lookups Using Compound Indexes

When you use a compound index for an interactive lookup, FileMan prompts you for values for each of the subscripts in the index.


Exercise 3.1.  Use the New-Style Index in an Interactive IX^DIC Call

In this lesson you will see how your lookup index affects the behavior of the lookup utility IX^DIC. You will also change the collation and lookup prompt for the DOB field in your "C" index.


Step 1. From programmer mode, set up the input variables and perform an IX^DIC call using the New-style "C" index. Afterward, enter two question marks (??) at the "Select ZZINDIVIDUAL DOB:" prompt.
>S DIC="^DIZ(662nnn,",DIC(0)="QEAZ",D="C"
>D IX^DIC

Select ZZINDIVIDUAL DOB: ??

   Choose from:
   OCT 31, 1919   012345678      RAINEY,GINGER
   FEB 05, 1932   555443333      GEISER,JASMINE
   APR 09, 1938   765432123      WELLS,PERIWINKLE
   MAY 20, 1945   234567890      RIVERS,HOLLY
   MAY 20, 1945   333221111      CURRENT,ROSEMARY
   MAY 22, 1947   444996666      SNOW,BASIL
   AUG 11, 1948   345678901      FROST,HAZEL
   JUN 02, 1955   777889999      BROOKS,SAGE
   JUL 14, 1959   888776666      WATERS,HERB
   NOV 23, 1969   111223333      LAKE,MARIGOLD
   MAR 21, 1970   678765432      PUDDLES,CHERVIL
   FEB 27, 1971   987654321      TIDE,DILL
   SEP 26, 1973   543891234      RIPPLE,SAFFRON
Note: In the listing above FileMan displays the values stored in the index, DOB and SSN, as well as the value of the NAME field (#.01).

Step 2. At the "Select ZZINDIVIDUAL DOB:" prompt enter 5/20/1945. Press Enter at the "SSN:" prompt, then press Enter again at the "CHOOSE 1-2:" prompt.
Select ZZINDIVIDUAL DOB: 5/20/1945
                    SSN: <Enter>
   1 MAY 20, 1945 234567890 RIVERS,HOLLY
   2 MAY 20, 1945 333221111 CURRENT,ROSEMARY
CHOOSE 1-2: <Enter> ??
Step 3. At the "Select ZZINDIVIDUAL DOB:" prompt enter 5/20/1945, then at the "SSN:" prompt enter 333:
Select ZZINDIVIDUAL DOB: 5/20/1945
                    SSN: 333
MAY 20, 1945 333221111 CURRENT,ROSEMARY

End of Exercise 3.1.



Passing Lookup Values for Lookups Using Compound Indexes

Suppose you want to perform a lookup on the "C" index, but pass the lookup values to IX^DIC, rather than prompt the user for the values. Normally, in this kind of non-interactive lookup, you would pass the lookup value in the variable X. But with a compound index, you might want to look up a record based on the values of more than one field. FileMan allows you to pass in multiple values via the X(n) array, where n corresponds to the subscript number in the index. You can set X(1) to the lookup value for the data in subscript 1 (after the index name), X(2) to the lookup value for the data in subscript 2, etc.


Exercise 3.2.  Use the New-Style Index in a Non-Interactive IX^DIC Call

In this exercise, you will make a non-interactive call to IX^DIC, passing in the lookup values in the X(subscript#) array.

Step 1. Set up the input variables for a non-interactive IX^DIC call using the "C" index:
>S DIC="^DIZ(662nnn,",DIC(0)="QZ",D="C"
Step 2. Set the X array to the lookup values shown below, and perform an IX^DIC call:
>S X(1)="5/20/1945",X(2)=333
>D IX^DIC
Step 3. Enter ZWRITE (ZW) Y at the programmer mode prompt to see the results of the lookup.
>ZW Y <Enter>
Y=1^CURRENT,ROSEMARY
Y(0)=CURRENT,ROSEMARY^333221111^2450520
Y(0,0)=CURRENT,ROSEMARY

End of Exercise 3.2.



Collation Property

New-style indexes allow you to control the direction in which FileMan traverses an index when it displays entries to the user. This is done via the Collation property of cross-reference subscripts. Normally, you would display entries in ascending alphabetical order, and so the collation for most subscripts is forward. But if you would like FileMan to traverse a subscript in an index in reverse order, you could change the collation of the subscript to backward.


Lookup Prompt Property

The Lookup prompt property of cross-reference subscripts can also be changed so that interactive lookups will use that string, rather than than the field Label, to prompt the user for a lookup value.


Exercise 3.3.  Change Collation and Lookup Prompt for DOB in "C" Index

In this exercise, you will change the collation of the DOB subscript in our "C" index so that most recent DOBs are displayed first. You will also change the Lookup prompt to DATE OF BIRTH instead of DOB.

Step 1. Follow the menu path to the option Cross Reference a Field or File:
VA FileMan
   Utility Functions
      Cross Reference a Field or File
Step 2. Select NEW for the type of cross-reference, then select your ZZINDIVIDUAL test file at the "MODIFY WHAT FILE:" prompt. Press Enter at the "Select Subfile:" prompt.
What type of cross-reference (Traditional or New)? Traditional// NEW

MODIFY WHAT FILE: // ZZINDIVIDUAL
Select Subfile: <Enter>

Current Indexes on file #662nnn:
  nnn    'C' Index

Choose E (Edit)/D (Delete)/C (Create): E <Enter>
Which Index do you wish to edit? nnn// C <Enter>
Step 3. Next, you are presented the ScreenMan form where you can edit the properties of your "C" index. Press <PF1>Down or <PageDown> to go to page 2.


Step 4. Press Enter on the number 1 in the "Order…" column to edit the properties of the cross-reference value with Order number 1, the DOB field. A pop-up page opens where you can edit the properties of the DOB cross-reference value. Tab to Collation and enter B for backwards and press Enter.


Step 5. Tab to the "Lookup Prompt:" field, enter: DATE OF BIRTH.


Step 6. Press <PF1>E to close the pop-up page. Press <PF1>E again to save changes and exit the form.


Step 7. From programmer mode, set up the input variables and perform an IX^DIC call using the "C" index. Afterward, enter two question marks (??) at the "Select ZZINDIVIDUAL DATE OF BIRTH:" prompt.
>S DIC="^DIZ(662nnn,",DIC(0)="QEAZ",D="C"
>D IX^DIC

Select ZZINDIVIDUAL DATE OF BIRTH: ??

  Choose from:
  SEP 26, 1973 543891234 RIPPLE,SAFFRON
  FEB 27, 1971 987654321 TIDE,DILL
  MAR 21, 1970 678765432 PUDDLES,CHERVIL
  NOV 23, 1969 111223333 LAKE,MARIGOLD
  JUL 14, 1959 888776666 WATERS,HERB
  JUN 02, 1955 777889999 BROOKS,SAGE
  AUG 11, 1948 345678901 FROST,HAZEL
  MAY 22, 1947 444996666 SNOW,BASIL
  MAY 20, 1945 234567890 RIVERS,HOLLY
  MAY 20, 1945 333221111 CURRENT,ROSEMARY
  APR 09, 1938 765432123 WELLS,PERIWINKLE
  FEB 05, 1932 555443333 GEISER,JASMINE
  OCT 31, 1919 012345678 RAINEY,GINGER

End of Exercise 3.3.



Lesson 3 Quiz Button Select this link to test yourself on what you've learned in this lesson.

[<-- Previous Lesson]   [Intro] [1] [2] 3 [4] [5] [6] [7] [8] [9] [10] [11]   [Next Lesson -->]

 


Reviewed/Updated: March 20, 2007