Examples of $QUERY()

Example:

    SET ^X(1,2,3)="123"
    SET ^X(1,2,3,7)="1237"
    SET ^X(1,2,4)="124"
    SET ^X(1,2,5,9)="1259"
    SET ^X(1,6)="16"
    SET ^X("B",1)="AB"    
    

The tree diagram below represents the structure produced by the preceding routine.

The following routine:

    SET y="^X"
    FOR SET y=$QUERY(@y) QUIT:y="" WRITE !,y,"=",@y    
    

produces the results:

    ^X(1,2,3)=123
    ^X(1,2,3,7)=1237
    ^X(1,2,4)=124
    ^X(1,2,5,9)=1259
    ^X(1,6)=16
    ^X("B",1)=AB