Question
· Mar 27, 2020

Management Portal: how to view globals in opposite order?

A simple question: View Global Data  page shows globals always in ascending subscript order. Very often I need to see latest page, is there any trick for this?

Update: I mean to see last subscripts in Management Portal, not using the code

Discussion (27)2
Log in or sign up to continue

I don't know of reverse  order

BUT if you have some idea of the last subscript you may enter the starting  subscript.

instead of seeing the whole Global ^CONFIG

just one specific  subscript ^CONFIG("Telnet"

os starting from a specific subscript ^CONFIG("Telnet":

or from:to subscript ^CONFIG("ECP":"Journal"

or just the select subscript level with a closing bracket ^CONFIG("ECP":"Journal")

Basically it is the same behavior  of the ancient (not to say antique) routine ^%G

When it was written traversing a Global in reverse order was not implemented in Caché nor ist'S predecessors.
So no reverse display

It has a help function that tells you it's capabilities  DO HELP^%G

The %G utility displays global nodes. A "?" at the "Global ^" prompt
displays the global directory.
If you enter just the name of a global,
%G displays the entire global. You may also display a portion of the
global at different subscript levels or specific nodes.
 
A complete global reference, such as ^GLO(3,"BED",5) will display
only that particular node. You may specify a subtree, such as
^GLO(3,"BED", to display all descendants of that node. To display
both the node and its descendants, do not end your entry with a
comma or a right parenthesis.
 
You can leave a subscript field empty when you specify the subtree and
the %G utility displays any nodes matching the other subscripts:
^GLO(,"BED") will match any nodes with 'BED' as the second subscript.

 
You can specify a range of subscripts for a particular subscript
level by inserting a colon between the first and last subscript in the
range: ^PT(1,"ACC":"BIRTH"
 

You can use variables and simple expressions in a subscript
specification by assigning a value to the variable before calling %G.
For example SET ID=214 and enter something like ^PT(ID,0).

 

it is an IRIS export

<?xml version="1.0" encoding="UTF-8"?>

<Export generator="IRIS" version="26" zv="IRIS for Windows (x86-64) 2019.1.1 (Build 609U)" ts="2020-03-22 18:56:51">

 

while for Cache it ooks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Export generator="Cache" version="25">

 

it might be sufficient to change 26 to 25 to make your Caché happy

Easy to do that.

Here's how.

First of all let's find out where we do the iteration. If we open UtilExpGlobalView.csp we see that it's essentially a wrapper over %CSP.UI.System.GlobalViewPane.

In %CSP.UI.System.GlobalViewPane there's a LoadGlobal method which has this promising line:

Set tRS = ##class(%ResultSet).%New("%Global:Get")

Next we follow the trail to %Library.Global class implementing  Get query, which has GetFetch method, which actually iterates over the global here:

Set idx=$Order($$$ISCQUERYTEMP(Index,idx),1,Row)

So now we wrap it up back.

We need a new query (GetFetch is copied as is with one change - inverse iteration order, bolded):

 
Test.Global class

Now we wrap it into a pane

 
Test.GlobalViewPane

And finally create a csp page

 
UtilExpGlobalViewR.csp

And done, add R to URL and see the global in reverse in SMP: