Idea Delivered

This was delivered with XPP 9.4.

Access Named number registers from xyPerl

The value of number registers can be read directly from xyPerl using the $X->get_reg(#NUMBER) function.

But for named number registers there is no equivalent function.
It would be nice if there would be a $X->get_named_reg(NAME, LEVEL) function (or similarly named function).
Currently you have to use the $X->nnx(NAME, LEVEL, X-register) and then do a $X->get_reg(xNUMBER) in order to access the value stored in a named register.
That is a bit a cumbersome and confusing way for something that should be simple.

  • It looks to me that this has been completely implemented.
    Time to mark it as 'implemented in 9.4' so it is taken out of the list of 'active ideas'

  • I don't remember seeing your comment from September via email (the post itself or via digest); I think we've had some problems where emails for Ideas have not successfully gotten sent out (or I just "missed" back then that I could give feedback on your comment). I just happened to catch your (old) comment today as I was perusing through the XPP Ideas.

    It would be best for you to open a support ticket, especially since it's in regards to documentation (so you can explain exactly what you think is lacking).

    And if you "carefully" read the CSS manual (page 4-9), at least in the examples (although I feel it's also implied earlier in the description of the "level"), I believe that you will see that it shows that if you do not supply a "level" you get the current level:
    # To get the value of the named number register ’numreg’
    with the number of the current tag numbering level
    my $num = $X->get_reg("#numreg");

    That seems sufficient to me, but perhaps you want to include in your support ticket some clarification(s) in the CSS manual as well (in addition to those in the XyMacros manual).  Slight smile

  • Jonathan,

    That is excellent news but if nobody tells us we will not know!
    I hate it when one has to look in 3 different places to find the correct answer.
    Do I have to raise a support ticket to ask to correct the xymacro manual or will you do it for me? (a big thanks if you do)

    And I am still left with the question: 
    What happens if I do not supply a level?
    Do I automatically get the current level? 

  • Bart,

    I think you missed something and it is possible to specify the requested "level" that you want.

    Yes, I see that the Release Notes did not go into the "details" (about specifying the requested "level") and just pointed to the Styling Content with CSS manual for more information (and yes also pointed to the XyMacros manual, where it's just giving some examples but not specifically a requested "level" example).

    Take a look at page 4-9 of the CSS manual where it gives the detailed syntax and shows some examples with a requested "level":
    get_reg("#NumberName[:level]")

    So, after the end of the name of the register you add a colon and the requested "level" number.

    Jonathan Dagresta
    RWS XPP Engineering

  • This has been addressed partly in XPP V9.4.
    It is now possible to use $X->get_reg(NAME) to get the value stored in named counter NAME.

    I can only assume that you will get the value stored in the current level (xymacro book is not clear about this)

    What is missing is the possibility like you have in the nnx macro to access the values stored in a different level.
    Using a $X->nnx() will not work as explained before.
    So please give us an optional second argument to the get_reg function that would allow us to access the values from a different level.
    (a would give us the value from the current level if no LEVEL argument has been specified)