#Globals

4 Followers · 231 Posts

Globals are multidimensional sparse arrays which are stored in InterSystems Data Platform. Everything in InterSystems Products is stored in Globals: Classes, Tables, Documents, Code.

Documentation.

Article Robert Cemper · Aug 10, 2023 3m read

As noted in the previous article Native API has some limits.
So I did some research on a more Terminal-like interface that
provides me with access like a console or the IRIS terminal
to allow my  $QUERY over a global and other nice commands
that are not supported/mapped in NativeAPI for ObjectScript.

The basic tools are well-prepared and available.

  • Connection() creates a fully operational and stable partition for me
  • Function() allows calling any routine or method I need
  • similar ClassMethodValue and ClassMethodVoid

There is just no method CommandLine and some already prepared code is neede











1
0 310
Article Robert Cemper · Aug 10, 2023 3m read

This question originally appeared in the comments of the post: Download globals from a particular server
 

This article was inspired by a recent question from @Evgeny Shvarov 
Download globals from a particular server
It is not a click-and-run code but a draft that requires adjustments for your special needs
you have  to add 

  • your credentials for server access
  • your level of error handling
  • Global name
  • the first set of subscripts as  %LB() block default=""
  • the last set of subscripts as  %LB() block default=""
  • a new global name if required default="" >> name not changed

If nothing than th

1
0 340
Question Rathinakumar S · Jul 26, 2023

Hi,

We have a global with 65 million entries. All we are doing is just iterating through each entry to find out the total no of entries. It is currently taking 110 minutes. Is this something normal? What can we do to speed up this process? Below is the program for just iterating each entry in the global.

s sub=" ,count=0
f{              
     s sub=$o(^YYY(sub)) q:sub=""
     s count= count +1
     }
     w!, "Total Count:"_ count
 

19
1 682
Article Mihoko Iijima · Jul 20, 2023 4m read

InterSystems FAQ rubric

You can search for a specific global variable in the journal file using the ByTimeReverseOrder query of the %SYS.Journal.File class and the List query of the %SYS.Journal.Record class.

The role of each query is as follows.

A) %SYS.Journal.File query of the ByTimeReverseOrder class

You can get the journal file name. Results are returned in descending order of journal file name. 

USER>set stmt=##class(%SQL.Statement).%New()

USER>set status=stmt.%PrepareClassQuery("%SYS.Journal.File","ByTimeReverseOrder")

USER>set rs=stmt.%Execute()

USER>while rs.%Next() { wr
1
1 519
Article Eduard Lebedyuk · Aug 3, 2020 3m read

InterSystems IRIS currently limits classes to 999 properties.

But what to do if you need to store more data per object?

This article would answer this question (with the additional cameo of Community Python Gateway and how you can transfer wide datasets into Python).

The answer is very simple actually - InterSystems IRIS currently limits classes to 999 properties, but not to 999 primitives. The property in InterSystems IRIS can be an object with 999 properties and so on - the limit can be easily disregarded.

13
1 879
Question Sukhpreet Singh · Jul 15, 2023

I have created a global say ^myglobal and entered some data. I am storing the name of global in databases and fetching the name based on some criteria. I am getting "^myglobal" in return from databases but i am not able to fetch the data I stored in the global. 

I tried set var = result.global which gives me "^myglobal" in var. Doing WRITE var will return "^myglobal" and not the data i stored in this global.

5
1 442
Article Mihoko Iijima · Jul 13, 2023 2m read

InterSystems FAQ rubric

It can be obtained by using the Size query of the system-provided %SYS.GlobalQuery class.

See the sample code below for usage examples.
*Please check the class reference for specifying columns and parameters.

 set dir="C:\intersystems\iris\mgr\user" // IRIS.DAT(or CACHE.DAT) folder
 set rs = ##class(%ResultSet).%New("%SYS.GlobalQuery:Size")
 do rs.Execute(dir) // You can also specify a mask with the 3d parameter
 while (rs.Next()) { 
   set gname= rs.Get("Name") // global name
   set gsize= rs.Get("Used MB") // global size (MB)
   write gname," : ",gsize,!
 }
0
2 661
Article Robert Cemper · Jun 20, 2022 7m read

My major interest is  Working with Globals in Embedded Python.
So I checked the available official documentation.

#1 Introduction to Globals
an attempt of a generic description of what a global is. Pointing to

#2 A Closer Look at ObjectScript
But where is Embedded Python ?
Way down you see

#3 Embedded Python

3.1 Embedded Python Overview
3.1.1 Work with Globals

Great if you have never seen a Global before
Otherwise a shocking primitive example
3.2 Using Embedded Python
Last hope: >>> but there is just NOTHING visible.
This is more than just disappointing! Even IRIS Native API for Python is more det

8
3 1346
Question Lakshmi Ankireddipalli · Jun 16, 2023

We are trying to come up with huge DataStore which needs to store HIPAA transactions and Data getting partitioned with idkey - YYYYMM.  Current Live data get inserted into current Month DB -  HIPAA_202306. 10 years (Hipaa retention policy) old data is going to be sitting in to 120 DBs ( 201606_HIPAA, 201607... 202305) for historical audit legal compliance purposes.

Currently if we create Namespace we get 2 databases - CODEDB for routes/classes & DATADB for journals data.  

In our requirement, Global mapping should point to 120 DataDbs. How would we Map/design this using Globals. 

Really app

7
0 468
Question Norman W. Freeman · Jun 9, 2023

Hello,

I would like to get a list of all globals that have been read or written during a given context. In Portal, there are counters in dashboard that give the number of read/write to globals in general.

What I am looking for : 

- some handler (eg: like $ZTRAP) that will be called everytime something is read/written to a global.

- to activate a "global log mode" in Portal that will dump some information to a file (like ^ISCSOAP for SOAP requests).

I understand this is something that can considerably slow down IRIS, but it's intended to be used only for debbuging and under no load.

As la

2
0 380
Question Lucas Galdino · Apr 27, 2023

Dear experts,
Please, could you help me?

Im trying import a global:

ACB> K ^GlobalManualSend
ACB> D $System.OBJ.Load("C:\Users\BNAPC\GlobalManualSend.xml")
ACB> Set sc = ##class(%Studio.Project).InstallFromGbl("^GlobalManualSend","fv")

But is returning a error about version:

Please, could you help me about it?

Thank you.

5
0 360
Question Punit · Apr 24, 2023

I have a %GlobalBinaryStream object that I'm trying to save as a local file after being received through a SOAP Web Service.

To do this, I created a %Stream.FileBinary object and wanted to set where the stream copied to this object would be saved by using either the DefaultStreamDir() ClassMethod or the NewFileName() ClassMethod. However, the documentation isn't very helpful on how to use these ClassMethods.

Right now, I have the below code:

set localStream = ##class(%Stream.FileBinary).%New()
set st = localStream.CopyFromAndSave(file) /// file is the %GlobalBinaryStreamObject
$$$QuitOnEr
4
0 332
Question Robert Cemper · Mar 17, 2023

During my last migration to IRIS I met this Compatibility parameter

  • NullSubscripts    true
0 - Throw error when referencing a null subscript.
1 - Null subscript references do not throw an error.

The consequences are shocking. This was allowed:

USER>zw^rcc^rcc=0^rcc("")="***"^rcc("",1)="*,1"^rcc(1,"")="1,*"^rcc(1,2)="1,2"^rcc(1,2,"")="1,2,*"

But SMP had no idea what is going on. 

And after switching off that flag this was still partialy visible, but read-only

USER>zw^rcc^rcc=0^rcc(1,"")="1,*"^rcc(1,2)="1,2"^rcc(1,2,"")="1,2,*"

I just don't understand.

5
0 435
Question Mark Charlton · Feb 17, 2023

I know this problem something to do with sort and collation and string comparison vs numeric only strings, but I can't fathom out the details of it. 

I have the following global, where all values are suffixed with a space, I believe the intention is to prevent empty strings and force string comparisons rather than numeric. Which is fine when searching for an exact match, so searching for "ABC" internally looks for "ABC ", or "800999" looks for "800999 ". However one function tries to search for strings containing, (specifically beginning with), a partial code. So in the below data the example


12
0 529
Article Brendan Bannon · Aug 29, 2016 7m read

The Art of Mapping Globals to Classes 1 of 3

Looking to breathe new life into an old MUMPS application?  Follow these steps to map your existing globals to classes and expose all that beautiful data to Objects and SQL.

By following the simple steps in this article and the next two you will be able to map all but the craziest globals to Caché classes.  For the crazy ones I will put up a zip file of different mappings I have collected over the years.  This is NOT for new data; if you don’t already have existing global please just use the default storage.

If you still can’t make heads or tai


26
13 6213
Question Norman W. Freeman · Feb 15, 2023

Out of curiosity, I was looking in ^ROUTINE global to see how routines are stored internally.

I found out that lot of nodes are displaying "~pointer" as associated value (eg: instead of a string).

What are those pointers ? My guess is that it references some cache internal structure (eg: some nodes inside a B-Tree).

Is there a easily way to see what is behind ? Are pointers useful for user globals or is this something purely internal to Cache database ?

1
0 313
Article Robert Cemper · Jan 30, 2023 2m read

The similarity between JSON objects + arrays and Globals in IRIS or Caché is evident.
With small and medium size JSON objects navigation across %Dynamic Objects is comfortable.
But with large and/or deep cascaded objects it becomes a challenge.

The presented tool offers 3 variants

  • loading an already existing %Dyamic object or Array into a global of your choice
  • loading a %Stream containing a JSON object into a global of your choice
  • loading an external File containing a JSON object into a global of your choice
1
2 350
Question Norman W. Freeman · Jan 19, 2023

I have noticed that the way the nodes are ordered is different between 2 different environments.

If I create the following global :

set^TEMP("Z")=1set^TEMP("Ä")=1

Then I dump it with zwrite, I get this (which is expected):

^TEMP("Z")=1^TEMP("Ä")=1

However, on another machine, it gives me this :

^TEMP("Ä")=1^TEMP("Z")=1

The same goes for the following command (which return 0 or 1, depending environment) : 

write"Z"]]"Ä"

Both are running Windows 10, but one is running IRIS 2021.1, the other CACHE 2017.2.2.

I don't think that's the reason, maybe there's something else (a config

5
0 309
Question Martin Staudigel · Jan 9, 2023

Hello community,

is there anything special to consider when running a foundation production regarding purge jobs (Ens.Util.Tasks.Purge)? I am thinking specifically of the QuickStreams, which according to my information are stored in a temporary database until the system is restarted. Since a system reboot is much less frequent then the purges, I wonder what happens to the QuickStreams whose messages and headers have already been purged. Is there a way to view Quickstreams (not content, but rather metadata) e.g. via the Management Portal?

Thanks for your comments and hints,

best regards, Mar

3
0 285
Question Evgeny Shvarov · Oct 6, 2022

Hi folks!

I'm working with a global via Embedded Python as a class method. I init the handler for a global via:

gl=iris.gref("^Global")

What is the way to check the value at index ^Global("x","y")? E.g.:

In ObjectScript I'd do the following:

set result=$data(^Global("x","y"))

How do I do the same in Embedded Python?

I checked the documentation, but haven't found an answer.

4
0 313
Article Muhammad Waseem · Sep 20, 2022 8m read

Hi Community,
In this article, I will introduce Python Flask Web Framework. Together we will create a minimal web application to connect to IRIS and get data from it.
Below you can find the steps we will need to follow:

  • Step 1 : Introduction to Python Flask Web Framework
  • Step 2 : Installation of Flask module
  • Step 3 : Creation of web application using Flask
  • Step 4 : Use of HTML Templates 
  • Step 5 : Installation of IRIS Python Native module
  • Step 6 : Establishment of a connection with IRIS 
  • Step 7 : Transferring data from IRIS to Flask and displaying it

So Let's start with step 1

Step1-Introduction to Python Flask Web Framework 

Flask is a small and lightweight Python web framework that provides useful tools and features that make creating web applications in Python easier. It gives developers flexibility and is a more accessible framework for new developers since it allows to build a web application quickly using only a single Python file. Flask is also extensible and doesn’t requires a particular directory structure or complicated boilerplate code before getting started.


For more details please view Flask Documentations

2
1 1056
Question Craig Bishop · Sep 7, 2022

Hello All,

I have a class method on the DocRepo server that needs to query the data value of a global variable on the Edge server. 

I have looked at the documentation for 'Global Structure,' but I didn't find anything that helped.

Global Structure | Using Globals | InterSystems IRIS Data Platform 2022.1
 

I am able to access this global easily from the Edge server using the $Get function, but I need to access it from the DocRepo server.

Any suggestions would be greatly appreciated!

Thanks!

Craig

8
0 520
Question Mark OReilly · Aug 24, 2022

I am using $Query to loop through a global. 

When I use $GET to get the data all we get back is the global name. 

How do you get the value of the global after you have looped. 

Below is my example in terminal. 

Thank you in advance 

Set node = $Query(^FromExtraMed("")) 

w node
^FromExtraMed("A02",9220)

If i try w $GET(node) it returns 

^FromExtraMed("A02",9220)

If i had this hardcoded it would have got the value

w $GET(^FromExtraMed("A02",9220))
0,66340,2120

I have already read the documentation and it is not clear. Can someone advise? 

5
0 395