Menu

zwrite gems

2009-04-28
2012-12-29
  • George James

    George James - 2009-04-28

    I just discovered that zwrite accepts arbitrary expressions as range arguments for subscripts.  This is not mentioned explicitly in the documentation and, as far as I can decipher, it is only vaguely implied from an example that uses ":" as an expression.

    So what?  Well, it's quite common to have globals that go something like this:
    ^G=lastUsedTransactionId
    ^G(transactionId)=...

    With this newly discovered zwrite capability I can now easily look at the last few transactions by doing this:

    GTM>zwr ^transaction(^transaction-10:)

    This is the equivalent of the more long winded:
    GTM>w ^transaction
    123456
    GTM>zwr ^transaction(123446:)

    I expect zwrite contains other hidden gems.  If you know of any please share them.

    George

     
    • K.S. Bhaskar

      K.S. Bhaskar - 2009-04-28

      George --

      I guess the documentation could have been clearer, but...

      In general, the Programmers Guide uses and builds on the meta-language used in the M standard (ISO/IEC 11756:1999).  The documentation for ZWRite describes the command as accepting a series of comma separated zwrglvns.  Since the intent is that zwrglvn syntax is a superset of glvn syntax, the Programmers Guide describes the ways in which zwrglvn is more than glvn.  So, glvns are entirely acceptable for ZWRite.

      Hope this helps.  We will consider adding more examples when the Programmers Guide is updated.  Thanks for your comments.

      Regards
      -- Bhaskar

       
      • George James

        George James - 2009-04-29

        The implication that zwrglvn extended glvn was probably what I was overlooking.

        What I really miss from zwrite is the ability to list all the subscripts at a given level, including pointers, not just defined nodes.

        For example with this global:
        GTM>zwr ^g
        ^g(1,"brown",555555)=""
        ^g(1,"smith",111111)=""
        ^g(1,"smith",222222)=""
        ^g(1,"jones")=""

        I'd like to know what subscripts exist at level 2, perhaps something like this:

        GTM>zwr ^g(1,@)
        ^g(1,"brown")
        ^g(1,"smith")
        ^g(1,"jones")=""

        Perhaps there's a way of doing this that I just don't know about?

         

Log in to post a comment.