Using ACTIVITY
to Suppress Cross-Reference Execution
In this lesson you will learn about the
Activity property of New-style cross-references.
Activity
Cross-references are executed when a record
is re-indexed via one of the ^DIK entry points or when the Re-Index File option
on the VA FileMan Utility Functions menu is selected. Also, during a KIDS
installation, if the
KIDS
Build sends a file with data, records in the file may be reindexed
automatically.
The Activity cross-reference property allows
you to prevent a particular cross-reference from firing during a re-indexing
operation and/or a KIDS installation. By default, when you create a New-style
cross-reference, Activity is automatically set to "IR". Activity does not
control whether a cross-reference is fired when a record is added, edited, or
deleted.
If you wish to suppress the firing of the
cross-reference when VA FileMan's reindexing APIs (xxx^DIK) and when the
Re-Index File option is called, you can remove the "R" from Activity. (Note,
however, that if you explicitly select a cross-reference in an EN^DIK, EN1^DIK,
or ENALL^DIK call, or in the UTILITY FUNCTIONS/RE-INDEX FILE option on the VA
FileMan menu, that cross-reference will be fired whether or not its Activity
contains an "R".)
If you wish to suppress firing a
cross-reference during a KIDS installation, you can remove the "I" from
Activity.
Exercise 8.1. Reindex a Single Record
with IX1^DIK
In this exercise, you will reindex the
MODIFIED,ENTRY record via the IX1^DIK entry point. This causes the Set Logic of
the "AE" cross-reference you created in Lesson 7 to be executed.
Step 1.
Use VA FileMan's Enter or Edit File Entries option to edit the
AREA CODE field (#3.1) and the LOCAL NUMBER field (#3.2) of the MODIFIED,ENTRY
record. First change the area code to 111 and the local number to 111-1111.
Then change them again to 415 and 555-1234, respectively. This step simply
establishes a starting point for the values of the fields OLD PHONE NUMBER and
PHONE NUMBER.
Select OPTION NAME: ENTER OR EDIT FILE ENTRIES
INPUT TO WHAT FILE: ZZINDIVIDUAL// <Enter>
EDIT WHICH FIELD: ALL// 3.1 <Enter> AREA CODE
THEN EDIT FIELD: 3.2 <Enter> LOCAL NUMBER
THEN EDIT FIELD:
Select ZZINDIVIDUAL NAME: MODIFIED,ENTRY
AREA CODE: 111
LOCAL NUMBER: 111-1111
Select ZZINDIVIDUAL NAME: <space><Enter> MODIFIED,ENTRY
AREA CODE: 111// 415
LOCAL NUMBER: 111-1111// 555-1234
Step 2.
Use VA FileMan's Inquire to File Entries option to look at the
values of OLD PHONE NUMBER and PHONE NUMBER. Select a
STANDARD
CAPTIONED OUTPUT, and when asked whether to include COMPUTED fields, answer
R to include the Record Number in the display.
Select OPTION NAME: INQUIRE TO FILE ENTRIES
OUTPUT FROM WHAT FILE: ZZINDIVIDUAL// <Enter>
Select ZZINDIVIDUAL NAME: <space><Enter> MODIFIED,ENTRY
ANOTHER ONE: <Enter>
STANDARD CAPTIONED OUTPUT? Yes// <Enter> (Yes)
Include COMPUTED fields: (N/Y/R/B): NO// Record Number (IEN)
NUMBER: 14 NAME: MODIFIED,ENTRY
AREA CODE: 415 LOCAL NUMBER: 555-1234
PHONE NUMBER: (415) 555-1234 OLD PHONE NUMBER: (111) 111-1111
DATE CREATED: <Date/Time Created>
Step 3.
Use IX1^DIK to reindex the MODIFIED,ENTRY. Set DA to the record
number displayed in Step 2.
Use VA FileMan's Inquire to File Entries option to see the effect
of reindexing the entry.
Select OPTION NAME: INQUIRE TO FILE ENTRIES
OUTPUT FROM WHAT FILE: ZZINDIVIDUAL// <Enter>
Select ZZINDIVIDUAL NAME: <space><Enter> MODIFIED,ENTRY
ANOTHER ONE: <Enter>
STANDARD CAPTIONED OUTPUT? Yes// <Enter> (Yes)
Include COMPUTED fields: (N/Y/R/B): NO// Record Number (IEN)
NUMBER: 14 NAME: MODIFIED,ENTRY
AREA CODE: 415 LOCAL NUMBER: 555-1234
PHONE NUMBER: (415) 555-1234 OLD PHONE NUMBER: (415) 555-1234
DATE CREATED: <Date/Time Created>
Note:
The reindexing call IX1^DIK caused the Set Logic of the MUMPS "AE"
index you created in Lesson 7 to be executed. When an entry is reindexed,
fields aren't being edited, and so the old field values in the X1 array and the
new field values in the X2 array both equal the current field values. Hence,
when the Set Logic of our "AE" cross-reference is executed, both the OLD PHONE
NUMBER and PHONE NUMBER fields reflect the current values of the AREA CODE
(#3.1) and LOCAL NUMBER (#3.2) fields.
End of Exercise 8.1.
Exercise 8.2. See How Removing "R"
from Activity Affects the IX1^DIK Call
In this exercise, you will remove the "R"
from the Activity property of our "AE" cross-reference. This will cause the Set
Logic of that cross-reference not to be executed when you reindex a record with
IX1^DIK.
Step 1.
Before you begin this exercise, you need to re-establish the
starting point for the values of the fields PHONE NUMBER and OLD PHONE NUMBER.
To do this, enter the following command from programmer mode:
>D
MODENT^A6AKIT(662nnn)
Where 662nnn is the number of your copy of the
tutorial test file. This is equivalent to performing Steps 1 and 2 from
exercise 8.1
Step 2.
Edit the "AE" MUMPS cross-reference:
Select OPTION NAME: UTILITY FUNCTIONS
Select UTILITY OPTION NAME: CROSS-REFERENCE A FIELD OR FILE
What type of cross-reference (Traditional or New)? Traditional// NEW
MODIFY WHAT FILE: ZZINDIVIDUAL// <Enter>
Select Subfile: <Enter>
Current Indexes on file #662nnn:
nnn 'C' index
nnn 'D' index
nnn 'AD' index
nnn 'AE' index
Choose E (Edit)/D (Delete)/C (Create): EDIT
Which Index do you wish to edit? AE <Enter>
Step 3.
On
the first page of the ScreenMan, tab to the Activity field and remove the
"R".
Number: nnn
EDIT AN INDEX
Page 1 of 2
File: Index Name:
662nnn AE
Root File: 662nnn
Root Type: INDEX FILE
Short Description:
Update the PHONE NUMBER field when the AREA
CODE and LOCAL N
You actually would probably also want to remove the "I" from
Activity to suppress the firing of this cross-reference during a KIDS
installation when data is sent with the file.
Step 4.
Press <PF1>E to exit (and save) the form.
Step 5.
As
in Step 3 of Exercise 1, make an IX1^DIK call to reindex the MODIFIED,ENTRY
entry:
>S DIK="^DIZ(662nnn,",DA=14 D IX1^DIK
Step 6.
Use VA FileMan's Inquire to File Entries option to see the effect
of reindexing the entry.
NUMBER: 14 NAME: MODIFIED,ENTRY
AREA CODE: 415 LOCAL NUMBER: 555-1234
PHONE NUMBER: (415) 555-1234 OLD PHONE NUMBER: (111) 111-1111
DATE CREATED: <Date/Time Created>
Note:
The PHONE NUMBER and OLD PHONE NUMBER fields haven't been changed.
The reindexing call IX1^DIK did not execute the "AE" MUMPS cross-reference
because you removed the "R" from the Activity property of that
cross-reference.
End of Exercise
8.2.
Select this
link to test yourself on what you've learned in this lesson.