VA FileMan V. 22.0 Programmer Manual Banner


 

Main Chapter Getting Started Manual Advanced User Manual

Global File Structure


Attribute Dictionary: How to Read, an Example

Each attribute dictionary is stored descendent from a positive-valued, first-level subscript of this global. Each attribute dictionary, in itself, is also in the form of a file and thus consists of entries, cross-references, descriptor, and a reference to the data dictionary of the attribute of attributes (^DD(0)).

Following are the ^DD nodes associated with our sample EMPLOYEE file:

    ^DD(3,.01,0)="NAME^FR^^0;1^I X'?1A.AP1",".AP K X"
    ^DD(3,.01,.1)="EMPLOYEE NAME"
    ^DD(3,.01,1,0)="^.1^1^1"
    ^DD(3,.01,1,1,0)="3^B"
    ^DD(3,.01,1,1,1)="S ^EMP("B",$E(X,1,30),DA)="""
    ^DD(3,.01,1,1,2)="K ^EMP("B",$E(X,1,30),DA)"
    ^DD(3,.01,3)="NAME MUST BE 3-30 CHARACTERS, IN THE FORMAT LAST,FIRST"
    ^DD(3,1,0)="SEX^RS^M:MALE;F:FEMALE^0;2^Q"
    ^DD(3,2,0)="DOB^D^^0;3^S %DT="EX" D ^%DT S X=Y I X<1400000 K X"
    ^DD(3,2,.1)="DATE OF BIRTH"
    ^DD(3,3,0)="DEPARTMENT^P13'^DIZ(13,^0;4^Q"

Their meaning can be translated to:

The first field is NAME (full title: EMPLOYEE NAME). It is free text data which must start with at least one alpha followed by other alpha and punctuation characters and contains a comma. It is always required from the user and is stored in subscript 0, ^-piece 1 of each employee's entry. If the user types a question (?) when asked for the NAME, the user will see:

    NAME MUST BE 3-30 CHARACTERS, IN THE FORMAT LAST,FIRST

The EMPLOYEE file is cross-referenced by NAME so every time a name is changed, the corresponding subscript under ^EMP("B") is also changed. DA will always be the internal number of the employee when the cross-referencing code is executed. If a second cross-reference for NAME existed (for example, a trigger), it would be descendent from:

    ^DD(3,.01,1,2

The second field is SEX. It is stored as either M or F in the second ^-piece position of subscript 0 of each EMPLOYEE file entry. The user is required to respond and can type MALE instead of M, and FEMALE instead of F. The user will see the two choices displayed if a ? is typed when asked for SEX.

The third field is DOB (full title: DATE OF BIRTH). It is not required. If entered, it must be in the format of a date after 1840. It is stored in the third ^- piece of subscript 0 of the EMPLOYEE file entry.

The fourth field is DEPARTMENT; it is not required. It is a pointer to file number 13 and adding new entries (LAYGO) to the DEPARTMENT file from the EMPLOYEE file is NOT allowed as indicated by the apostrophe (') after the number 13. It is stored in the fourth ^-piece of subscript zero of the EMPLOYEE file entry. The internal value of the Employee's department in the DEPARTMENT file is stored in this location. The data of the DEPARTMENT file can be found in ^DIZ(13,.

Suppose there is also a multi-valued field, SKILL. A multiple-valued field is described by a separate data dictionary. FileMan creates this new data dictionary descendent from a non-integer subscript of ^DD. In the case of the EMPLOYEE file described by ^DD(3), it would store subsidiary data dictionaries in ^DD(3.01), ^DD(3.02), etc. The subsidiary data dictionary for the multiple-valued SKILL field could look like this:

    ^DD(3.01,0)="SKILL subfield^^1^2"
    ^DD(3.01,.01,0)="SKILL^MF^^0;1^K:$L(X)>30!($L(X)<3) X"
    ^DD(3.01,.01,3)="ANSWER MUST BE FROM 3 TO 30 CHARACTERS IN LENGTH"

The only new element here is the M in the second ^-piece of ^DD(3.01,.01,0). This is the flag corresponding to the 'YES' answer to the question:

    HAVING ENTERED OR EDITED ONE SKILL, SHOULD USER BE ASKED 
	ANOTHER?

If you answer 'YES' to this question, each time the user enters data, the "Select SKILL:" prompt will be repeated until the user enters a null response. There will also be an entry corresponding to SKILL in the principal EMPLOYEE file's data dictionary as follows:

    ^DD(3,4,0)="SKILL^3.01A^^SX;0"

The 3.01 points to the subsidiary data dictionary of that number; it says that, to find the data descriptors of SKILL (and all fields pertaining to SKILL), we must look in ^DD(3.01). The A indicates that every time the user enters a new SKILL, it will be automatically added to the file and the user will not be asked:

    ARE YOU ADDING A NEW SKILL?

The SX;0 in the fourth ^-piece tells us the entire SKILL subfile will be stored descendent from the SX subscript in each employee's record.

 


Reviewed/Updated: March 10, 2007