VA FileMan V. 22.0 Programmer Manual Banner


Main Chapter Getting Started Manual Advanced User Manual

Classic VA FileMan API

^DIK: Delete Entries

Call DIK at ^DIK to delete an entry from a file.

WARNING: Use DIK to delete entries with extreme caution. It does not check Delete access for the file or any defined "DEL" nodes. Also, it does not update any pointers to the deleted entries. However, it does execute all cross-references and triggers.

Input Variables

The global root of the file from which you want to delete an entry.

If you are deleting a subentry, set DIK to the full global root leading to the subentry, including all intervening subscripts and the terminating comma, up to - but not including - the IEN of the subfile entry to delete.


If you are deleting an entry at the top level of a file, set DA to the internal entry number of the file entry to delete. For example, to delete SAM SMITH, who is entry number 7, from the EMPLOYEE file, stored in the global ^EMP, write the following:

    S DIK="^EMP(",DA=7
    D ^DIK

If you are deleting an entry in a subfile, set up DA as an array, where DA=entry number in the subfile to delete, DA(1) is the entry number at the next higher file level,...DA(n) is the entry number at the file's top level. For example, suppose employee JOHN JONES (record #1) has two skill entries (subrecords #1 and #2) in a SKILL multiple. To delete the SKILL multiple's subrecord #2 you would write:

    S DA(1)=1,DA=2,DIK="^EMP("_DA(1)_",""SX"","
    D ^DIK 

where DA is the skill entry number in the subfile and DA(1) is the employee's internal entry number in the EMPLOYEE file.

Looping to Delete Several Entries

^DIK leaves the DA-array and DIK defined. So you can loop through a file to delete several entries:

    S DIK="^EMP(" F DA=2,9,11 D ^DIK

This deletes entries 2, 9 and 11 from the EMPLOYEE file.

Deleting Fields from a File

As discussed in the "How to Read an Attribute Dictionary" section of the Global File Structure chapter, each attribute dictionary is also in the form of a file. You can therefore use the routine DIK to delete a single-valued field (i.e., not a multiple) from a file. To do this, the variable DIK is set to the file's data dictionary global node; DA is set to the number of the field to be deleted; and DA(1) is set to the file number. To delete the field SEX from our EMPLOYEE file example, simply write:

    S DIK="^DD(3,",DA=1,DA(1)=3
    D ^DIK

When you use ^DIK to delete fields from a file, the data is not deleted.


Reviewed/Updated: March 8, 2007