| 1 | XBARRAY0        ; IHS/ADC/GTH - Documentation for XBARRAY ; [ 02/07/97   3:02 PM ] | 
|---|
| 2 | ;;4.0;XB;;Jul 20, 2009;Build 2 | 
|---|
| 3 | ; | 
|---|
| 4 | ; This utility provides a word processing format of free | 
|---|
| 5 | ; text and local variable references to build an array. | 
|---|
| 6 | ; | 
|---|
| 7 | ; A file is necessary that has a .01 field for the form | 
|---|
| 8 | ; name and a WP field to hold the WP form. | 
|---|
| 9 | ; | 
|---|
| 10 | ; Two Entry points | 
|---|
| 11 | ; | 
|---|
| 12 | ; EDIT^XBARRAY(.NAME,DIC,FIELD)  Edits and Displays the | 
|---|
| 13 | ;        form.  Place the call to EDIT in the code where | 
|---|
| 14 | ;        the data or variables have been gathered. | 
|---|
| 15 | ;        Typically this is one line previous to the call | 
|---|
| 16 | ;        to $$GEN^XBARRAY.  Once the form is designed the | 
|---|
| 17 | ;        EDIT call is commented out. | 
|---|
| 18 | ; | 
|---|
| 19 | ; $$GEN^XBARRAY(.NAME,DIC,FIELD,ROOT,FORMAT,LINE) | 
|---|
| 20 | ;        Generates the form into the ARRAY indicated by | 
|---|
| 21 | ;        the ROOT.  The call to $$GEN must have all | 
|---|
| 22 | ;        variables used gathered.  The return value of | 
|---|
| 23 | ;        $$GEN is equal to the last line set in the array. | 
|---|
| 24 | ; | 
|---|
| 25 | ; VARIABLES | 
|---|
| 26 | ;     .NAME - The name space variable that holds the name | 
|---|
| 27 | ;     of the form to be used.  A pass by reference is | 
|---|
| 28 | ;     needed for efficiency so that the pre-compilation of | 
|---|
| 29 | ;     the form is held for repetitive use. The compilation | 
|---|
| 30 | ;     is stored in the sub array as NAME(@NAME,line,.....,). | 
|---|
| 31 | ;     IE one local variable can be used for all form | 
|---|
| 32 | ;     references. | 
|---|
| 33 | ;             Ex: S BARFORM="A/R BILL"  will store and use | 
|---|
| 34 | ;     the form compilation in BARFORM("A/R BILL",line,....,) | 
|---|
| 35 | ;     When finished KILL BARFORM(BARFORM) will retrieve the | 
|---|
| 36 | ;     local variable space from the last form used. | 
|---|
| 37 | ; | 
|---|
| 38 | ;     DIC - The root or file number of the file holding the | 
|---|
| 39 | ;     forms. | 
|---|
| 40 | ; | 
|---|
| 41 | ;     FIELD ; The field number of the WP field holding the | 
|---|
| 42 | ;     form. | 
|---|
| 43 | ; | 
|---|
| 44 | ;     ROOT - The root of the target array to be built. | 
|---|
| 45 | ;     Either a global or a variable root as in the format | 
|---|
| 46 | ;     used for a %XY^%RCR call. (%RCR is actually used) | 
|---|
| 47 | ; | 
|---|
| 48 | ;     FORMAT | 
|---|
| 49 | ;       null or zero  The array is built ROOT(line)="... | 
|---|
| 50 | ;       1             The array is built ROOT(line,0)=".... | 
|---|
| 51 | ; | 
|---|
| 52 | ;     LINE - The offset in line numbers in building the | 
|---|
| 53 | ;     array.  The array will start construction at LINE +1. | 
|---|
| 54 | ;     The value of the last line created is returned $$GEN. | 
|---|
| 55 | ; | 
|---|
| 56 | ; WP FORMAT INSTRUCTIONS | 
|---|
| 57 | ; | 
|---|
| 58 | ;     Free Text:  Free text is key striked in where desired. | 
|---|
| 59 | ;                 Do not use ~ as it is used to mark variables. | 
|---|
| 60 | ; | 
|---|
| 61 | ;     Variables:  The reference to a variable is marked with | 
|---|
| 62 | ;         a beginning ~ and a trailing ~. The trailing ~ is | 
|---|
| 63 | ;         always required even if the variable is last item | 
|---|
| 64 | ;         on the line. | 
|---|
| 65 | ; | 
|---|
| 66 | ;     Mnemonics: A short hand for variables is available. | 
|---|
| 67 | ; | 
|---|
| 68 | ;     Comments:  Programmers comments can be put into the form | 
|---|
| 69 | ;         which are ignored by the generator. | 
|---|
| 70 | ; | 
|---|
| 71 | ;     Output Transform:  Mumps output transforms can be | 
|---|
| 72 | ;         indicated for execution upon selected variables. | 
|---|
| 73 | ; | 
|---|
| 74 | ; WP SPECIAL FUNCTIONS  Located at the top of the form. | 
|---|
| 75 | ; | 
|---|
| 76 | ; Comment line          Begin the line with a ';' | 
|---|
| 77 | ; | 
|---|
| 78 | ; Variable Mneumonic Reference:  Name spaced variables can | 
|---|
| 79 | ;         be long.  A mnemonic reference is available to make | 
|---|
| 80 | ;         life simple.  Multiple mnemonic lines can be used | 
|---|
| 81 | ;         if desired. | 
|---|
| 82 | ; | 
|---|
| 83 | ;     SETUP | 
|---|
| 84 | ; | 
|---|
| 85 | ;     #mnemonic1|variable1*mnemonic2|variable2*... | 
|---|
| 86 | ;     #mnemonicZ|variableZ*..... | 
|---|
| 87 | ; | 
|---|
| 88 | ;     Example:     #D|DUZ*V|BARVPT | 
|---|
| 89 | ;                  #I|BARIPT | 
|---|
| 90 | ; | 
|---|
| 91 | ;         (BARIPT array is storing IHS Patient Information) | 
|---|
| 92 | ;         (BARVPT array is storing  VA Patient Information) | 
|---|
| 93 | ; | 
|---|
| 94 | ; | 
|---|
| 95 | ;         '#'         Marker placed in the first column | 
|---|
| 96 | ; | 
|---|
| 97 | ;         mnemonic1  User's choice | 
|---|
| 98 | ;                     ex: D to denote DUZ | 
|---|
| 99 | ;         '|'         Separator | 
|---|
| 100 | ; | 
|---|
| 101 | ;         variable1   User's choice of the local variable | 
|---|
| 102 | ;                     ex: DUZ | 
|---|
| 103 | ;         '*'         Repetative marker if more than one | 
|---|
| 104 | ;                     mnemonic is indicated | 
|---|
| 105 | ; | 
|---|
| 106 | ;     USE        The mnemonic reference can be used any where | 
|---|
| 107 | ;                in the WP form. | 
|---|
| 108 | ; | 
|---|
| 109 | ;          Format     ~mnemonic|variable subscript~ | 
|---|
| 110 | ; | 
|---|
| 111 | ;         '~'         Beginning marker for the variable | 
|---|
| 112 | ; | 
|---|
| 113 | ;         mnemonic1  User's mnemonic | 
|---|
| 114 | ; | 
|---|
| 115 | ;         '|'         Separator | 
|---|
| 116 | ; | 
|---|
| 117 | ;         subscript   The subscript of the variable to be used | 
|---|
| 118 | ; | 
|---|
| 119 | ;         '~'         Ending marker for the variable | 
|---|
| 120 | ; | 
|---|
| 121 | ;                     ex:  ~D|~      for DUZ | 
|---|
| 122 | ;                          ~D|0~     for DUZ(0) | 
|---|
| 123 | ;                          ~I|.01~   for BARIPT(.01) | 
|---|
| 124 | ; | 
|---|
| 125 | ;  MUMPS OUTPUT TRANSFORM | 
|---|
| 126 | ;  A simple mumps output transform is also provided to aid | 
|---|
| 127 | ;  in form design.  A variable or mnemonic indicated will | 
|---|
| 128 | ;  have its output transformed prior to being put into the | 
|---|
| 129 | ;  form. | 
|---|
| 130 | ; | 
|---|
| 131 | ;  SETUP | 
|---|
| 132 | ; | 
|---|
| 133 | ;      *var1!mumps code1*var2!mumps code2 | 
|---|
| 134 | ;      *mnemonic3!mumps code3*mnemonic4!mumps code4 | 
|---|
| 135 | ; | 
|---|
| 136 | ;    Ex:     *DUZ(2)!$J(X,10,2)  will output $J(DUZ(2),10,2) | 
|---|
| 137 | ;            *D | 2!$J(X,10,2)     mnemonic notation of same | 
|---|
| 138 | ; | 
|---|
| 139 | ;    '*'          Output Transform marker in column one. At TOF | 
|---|
| 140 | ; | 
|---|
| 141 | ;    Variable/    Variable or mnemonic as it would appear in the | 
|---|
| 142 | ;    Mneumonic    form between '~'s. | 
|---|
| 143 | ; | 
|---|
| 144 | ;    '!'          Separator | 
|---|
| 145 | ; | 
|---|
| 146 | ;    mumps code   Mumps code expression as a function of x. | 
|---|
| 147 | ;                 Do not state 'S X=f(x)' | 
|---|
| 148 | ;                 Enter the function only, f(x). | 
|---|
| 149 | ; | 
|---|
| 150 | ;    '*'          Separator if more than one is put on one line. | 
|---|
| 151 | ; | 
|---|
| 152 | ; SPECIAL OUTPUT TRANSFORMS provided by XBARRAY | 
|---|
| 153 | ; | 
|---|
| 154 | ;  xxx!$$MDY(X)    a literal ~"NOW"~ or    variable ~IT|9~ | 
|---|
| 155 | ;      ex:         *"NOW"!$$MDY(X)   or    *IT|9!$$MDY(X) | 
|---|
| 156 | ;                  returns mm/dd/yy | 
|---|
| 157 | ; | 
|---|
| 158 | ;  xxx!$$WP("X")   for a word processing field | 
|---|
| 159 | ;  NOTE:    "X"    IS ABSOLUTELY NECESSARY | 
|---|
| 160 | ;                  The variable array must have the form | 
|---|
| 161 | ;                  VAR(subcript,n) where n = 1:1 | 
|---|
| 162 | ; | 
|---|
| 163 | DOCE    ; | 
|---|
| 164 | ; | 
|---|
| 165 | TEST    ; If you have A/R installed, uncomment the following lines for a | 
|---|
| 166 | ; demonstration. | 
|---|
| 167 | ; D INIT^BARUTL | 
|---|
| 168 | ; D ENP^XBDIQ1(200,DUZ,".01:.116","BARU(") | 
|---|
| 169 | ; S BARFORM="PW TEST" | 
|---|
| 170 | ; D EDIT^XBARRAY(.BARFORM,90053.01,1000) | 
|---|
| 171 | ; S Y=$$GEN^XBARRAY(.BARFORM,90053.01,1000,"BARFM",0,10) | 
|---|
| 172 | ; KILL BARFORM(BARFORM) | 
|---|
| 173 | ; Q | 
|---|
| 174 | ; | 
|---|