Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

$QUERY

Draft MDC Standard

7.1.5.19 $Query

$Q[UERY] ( glvn )

Follow these steps:

  1. Let glvn be a variable reference of the form Name(s1, s2, ..., sq ) where sq may be the empty string. If glvn is unsubscripted, initialize V to the form Name(""); otherwise, initialize V to glvn.
  2. If the last subscript of V is empty, Goto step e.
  3. If $Data(V) \ 10 = 1, append the subscript "" to V, i.e., V is Name(s1, s2, ..., sq, "").
  4. If V has no subscripts, return "".
  5. Let s = $Order(V).
  6. If s = "", truncate the last subscript off V, Goto step d.
  7. If s '= "", replace the last subscript in V with s.
  8. If $Data(V) # 2 = 1, return V formatted as a namevalue.
  9. Goto step c.

$Q[UERY] ( glvn , expr )

Let S be the value of expr. Then $Query( glvn , expr ) returns:

  1. If S = 1, the function returns a result identical to that returned by $Query( glvn ).
  2. If S = –1, the function returns a value which is either the empty string ("") or a namevalue according to the following steps:
    1. Let glvn be a variable reference of the form Name( s1 , s2 , ... , sq ) where sq may be the empty string. If glvn is unsubscripted, initialize V to the form Name(""); otherwise, initialize V to glvn.
    2. If the last subscript of V is empty, go to step e.
    3. If $Data(V)\10=1, append the subscript "" to V, i.e. V is Name( s1 , s2 , ... , sq ,"" ).
    4. If V has no subscripts, return "".
    5. Let s = $Order( V , - 1 ).
    6. If s = "", truncate the last subscript off V, and go to step j.
    7. If s '= "", replace the last subscript of V with s.
    8. If $Data( V ) # 2 = 1, return V formatted as namevalue.
    9. Go to step c.
    10. If $Data( V ) # 2 = 1, return V formatted as a namevalue
    11. Go to step d.
  3. Values of S other than 1 or –1 are reserved for future extensions to the $Query function.

If the value of $Query( glvn [ , expr ] ) is not the empty string, and glvn includes an environment, then the namevalue shall include the environment; otherwise the namevalue shall not include an environment.

If the argument of $Query is a gvn, the naked indicator will become undefined and the value of $Reference will become equal to the empty string.

Button for 1977 Button for 1984 Button for 1990 Button for 1995 Button for MDC Button for notes Button for examples

Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.

Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.

This page most recently updated on 15-Nov-2023, 13:11:39.

For comments, contact Ed de Moel (demoel@jacquardsystems.com)