798.87 (371)    INDEX (.11)

Name Value
FILE 798.87
NAME APSV1
DESCRIPTION
The APSV1 index allows to sort the XML reports on 
that comprise different parts of the XML document.
 
  2  "APSV",  2,    0,  " ",              3)
  2  "APSV",  2,    0,  " ",              6)
 
  5  "APSV",  2,    9,  "DOU, JOHN",      3)
  5  "APSV",  2,    9,  "SMITH, BOB",     6)
 
  6  "APSV",  2,   10,  "1935/10/05",     6)
  6  "APSV",  2,   10,  "1950/03/25",     3)
 
 
  3  "APSV",  3,    0,  " ",              4)
  3  "APSV",  3,    0,  " ",              5)
 
  4  "APSV",  6,    0,  " ",              7)
  4  "APSV",  6,    0,  " ",              8)
 
Let us look more closely at the first entry of the
sub-index #5 (also see Table 1):
 
 2  is the IEN of the REPORTS element in the
The index has the following structure:
    REPORT ELEMENT multiple;
 
 9  is the sorting mode (the IEN of the NAME
    element in the ROR XML ELEMENT file);
 
 "DOU, JOHN"
    is the value of the NAME element;
 
 3  is the IEN of the corresponding PATIENT
    element in the REPORT ELEMENT multiple.
 
 
If the sort mode 9 (NAME) is used then the
resulting XML document will look like this:
 
 <REPORT>
  <PATIENTS>
   <PATIENT>
    <NAME>DOU, JOHN"</NAME>
    <DOB>950/03/25</DOB>
   </PATIENT>
 ^RORDATA(798.8,Task,"RI",
   <PATIENT>
    <NAME>SMITH, BOB</NAME>
    <DOB>1935/10/05</DOB>
   </PATIENT>
  </PATIENTS>
 </REPORT>
 
If the sort mode 10 (DOB) is used, the resulting
XML document will look as follow:
 
    "APSV",List,Sort,ItemValue,ItemIEN) = ""
 <REPORT>
  <PATIENTS>
   <PATIENT>
    <NAME>SMITH, BOB</NAME>
    <DOB>1935/10/05</DOB>
   </PATIENT>
   <PATIENT>
    <NAME>DOU, JOHN"</NAME>
    <DOB>950/03/25</DOB>
   </PATIENT>
 
  </PATIENTS>
 </REPORT>
'Task' is the IEN of the main task record (it is
equal to the task number).
 
the server side. 
'List' is the IEN of the list.
 
'Sort' is the sorting mode. It is the internal 
value of the REPORT ELEMENT field (the IEN of the
XML element in the ROR XML ELEMENT file). Each
list can be sorted in different ways. The APSV0
index always uses 0 as the value of this
subscript.
 
'ItemValue' is the value of the list item. The
 
APSV0 index always uses " " as the value of this
subscript.
 
'ItemIEN' is the IEN of the list item.
 
To clarify, below is an example of some sample 
content of the REPORT ELEMENT multiple:
 
 IEN  Element (int)   Parent IEN  Value
 ---  --------------  ----------  ------------
The APSV0 and APSV1 indexes work together and the
   1  REPORT    ( 1)         0
   2   PATIENTS ( 3)         1
   3    PATIENT ( 5)         2
   4     NAME   ( 9)         3    "DOU, JOHN"
   5     DOB    (10)         3    "1950/03/25"
   6    PATIENT ( 5)         2   
   7     NAME   ( 9)         6    "SMITH, BOB"
   8     DOB    (10)         6    "1935/10/05"
 
      Table 1. Sample Report Elements
entries of both indexes are created under the same
 
The element names are indented to emphasize the 
hierarchical structure of the document.
 
The numbers in parentheses after the element names
represent the internal values of the REPORT 
ELEMENT field (the IENs in the ROR XML ELEMENT
file).
 
Several lists can be isolated from this example:
"APSV" subscript.
 
  #   List      Items
 ---  -------   -------------------------------
  1   REPORT    PATIENTS
  2   PATIENTS  PATIENT, PATIENT
  3   PATIENT   NAME, DOB
  4   PATIENT   NAME, DOB
 
  5   PATIENTS  "DOU, JOHN", "SMITH, BOB"
  6   PATIENTS  "1935/10/05", "1950/03/25"
 
 
      Table 2. The Lists
 
The first four lists contain just the report
elements themselves. They are used to render the
elements into XML tags in the same sequence as the
elements were created by the report builder. For
example, the <DOB> tag will always follow the
<NAME> tag.
 
The resulting index actually consists of several 
The logic of the APSV0 index handles these
sub-indexes. They always have 0 as the sorting
mode and " " as the item value.
 
The last two sub-indexes are handled by the logic
of the "APSV1" index. As illustrated in the
example, the lists are associated with the
PATIENTS element, they comprise the PATIENT
elements, and are sorted by the values of the NAME
and DOB elements. Three levels of the hierarchy
sub-indexes (lists). Each index sorts the items
are covered by each of these sub-indexes.
 
Let us look at the corresponding index. The 
numbers in the first column indicate the 
corresponding lists from Table 2. The sub-indexes
are separated by empty lines:
 
  #         List  Sort   ItemValue     ItemIEN
 ---        ----  ----  -------------  -------
  1  "APSV",  1,    0,  " ",              2)
SHORT DESCRIPTION Sorts the XML report on the server
TYPE MUMPS
EXECUTION RECORD
ACTIVITY IR
USE SORTING ONLY
ROOT TYPE INDEX FILE
ROOT FILE 798.87
SET LOGIC S ^RORDATA(798.8,DA(1),"RI","APSV",X(2),X(3),X(6),X(1))=""
SET CONDITION CODE S X=(X(5)>0)
CROSS-REFERENCE VALUES
  • ORDER NUMBER:   1
    SUBSCRIPT NUMBER:   4
    TYPE OF VALUE:   FIELD
    FILE:   798.87
    FIELD:   .02
    COLLATION:   forwards
  • ORDER NUMBER:   5
    TYPE OF VALUE:   FIELD
    FILE:   798.87
    FIELD:   .03
  • ORDER NUMBER:   2
    SUBSCRIPT NUMBER:   1
    TYPE OF VALUE:   COMPUTED VALUE
    COMPUTED CODE:   S X=$S(X(1)>0:$P($G(^RORDATA(798.8,DA(1),"RI",X(1),0)),U,2),1:"")
  • ORDER NUMBER:   6
    SUBSCRIPT NUMBER:   3
    TYPE OF VALUE:   COMPUTED VALUE
    COMPUTED CODE:   S X=$$SORTBY^RORDD01(X(5),X(4))
    MAXIMUM LENGTH:   30
  • ORDER NUMBER:   3
    SUBSCRIPT NUMBER:   2
    TYPE OF VALUE:   FIELD
    FILE:   798.87
    FIELD:   .01
    COLLATION:   forwards
  • ORDER NUMBER:   4
    TYPE OF VALUE:   FIELD
    FILE:   798.87
    FIELD:   1
    MAXIMUM LENGTH:   30
    COLLATION:   forwards
KILL LOGIC K ^RORDATA(798.8,DA(1),"RI","APSV",X(2),X(3),X(6),X(1))