#Globals

0 Followers · 227 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.

Question Mack Altman · Jan 6, 2017

Currently, we have an application running in one namespace ("Database B") that has globals and routines mapped to another database ("Database A"). After enforcing clean up on Database A, we found that 90% of the disk is free. We would like to compact Database A and release the unused space. However, we are running OpenVMS, which seems to be the issue.

For databases consisting of only globals, we are able to use ^GBLOCKCOPY; however, we need to ensure that the routines and mappings are also copied.

What would be the best recommended way to do this?

8
0 1218
Question Alexander Brown · Feb 6, 2017

If I were trying to access an index of a global variable, what time complexity would this operation have? My understanding of languages like Java/C++ is that arrays are stored as blocks of memory so that x[15] would have a lookup time complexity of O(1) because it just goes to (address of the array + 15) and retrieves the value stored there.

How does this work in Cache where the index of a variable isn't necessarily an integer value? If I were to have a variable like the following:

x("Adam") = "Red"

x("George") = "Blue"

x("Bryan") = "Green"

etc...

5
0 589
Question Mack Altman · Jan 21, 2017

Can someone direct me to where in the documentation we can find how consumption may be calculated for global storage?

Caché Version 2010.1
Operating System HP OpenVMS 8.4

EDIT: After receiving some responses, it seems I was unclear in my initial inquiry. I am looking to determine our rate of consumption of storage; however, I am having some difficulty in doing that.

While utilizing ^%GSIZE, which is used by the %GlobalEdit class, the results appeared odd. I have provided my results below, which illustrate the global structure on the left and the usage indicated by ^%GSIZE on the right.

6
0 872
Question Mack Altman · Dec 27, 2016

Currently, namespace Alpha is configured to use database AlphaDB as its global database. How would we go about having namespace Alpha configured to use database AlphaDB for its global database except where global ^Customers(CustomerId) has a CustomerId greater than 10M, which we would like to have it redirected to database BetaDB.

In other words, ^|"AlphaDB"|Customers contains all customers between 1 and 10,000,000; and ^|"BetaDB"|Customers contains all customers greater than 10,000,000. Any help would be appreciated.

4
0 550
Question Laura Cavanaugh · Dec 6, 2016

Hello.  When you export and then import a table of data, is the import smart enough to figure out if a row already exists in the new namespace, and if so update the row rather than just save/add the row?

For example, we have a table in DEV, and the same table in QA.  The DEV table has more fields than QA.  When we moved up the class, the field definitions went with the table into QA, so now the table definition is the same in both.

2
0 573
Article Kyle Baxter · Aug 29, 2016 6m read

This post is the direct result of working with an InterSystems customer who came to me with the following problem:

SELECT COUNT(*) FROM MyCustomTable

Takes 0.005 seconds, total 2300 rows.  However:

SELECT * FROM MyCustomTable

Took minutes.  The reason for this is subtle and interesting enough for me to write a post about.  This post is lengthy, but if you scroll to the bottom I'll write a quick summary, so if you've gotten this far and think you've already read enough, scroll to the end to get the main point.  Check for the sentence in bold.

11
0 1433
Article Mike Kadow · Sep 15, 2016 2m read

NewBie's Corner Session 27 Traversing A Global with $Order Part 1

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

Traversing A Global

Perhaps the most difficult concept in Caché/MUMPS is its Global Structure. This session and several that follow it deals with the Global Structure. However, just presenting the material will not guarantee your understanding of it. You must experiment with the data and concepts that are presented.

In this session, we are going to create a small Global of three levels deep, and then show the code to Traverse the Global.

20
0 879
Article Eduard Lebedyuk · Sep 26, 2016 2m read

We're developing Ensemble PoC and one day our frontend developer (who doesn't have Ensemble production running) said that Populate just doesn't cut it and he needs to see the real data. He needed only one object, but the problem was - it's a big object. Still, I checked ids of everything related and wrote this command (parts omitted, but you get the idea):

1
0 779
Question Eduard Lebedyuk · Sep 16, 2016

Let's say I have a global named ^a and I need to export its nodes 1, 2, 3, 5 only.

Currently I write something like this:

Write $SYSTEM.OBJ.Export("a(1).gbl,a(2).gbl,a(3).gbl,a(5).gbl", "C:\Users\eduard\Desktop\a.xml")

Is there a way to write it shorter? I want to write global node once and list all the subscripts I need.

1
0 754
Question Sebastian Mueller · Aug 25, 2016

Let's imagine I have a global like this:

^Users(12, "SETTINGS", "IsAllowed") = 1

^Users(41, "SETTINGS", "IsAllowed") = 0

^Users(52, "SETTINGS", "IsAllowed") = 1

Now I would like to check for each user whether they are allowed, therefore I'd need to iterate through the Global. How to do that? It seems that I can't use $Order here like such:

S FF = ""
For {
 S FF=$O(^Users(FF,"SETTINGS","isAllowed"))
 Q:$L(FF)
 W "User ",FF," is allowed",!
}

Is there any other way of doing this? 

5
0 1251
Article Eduard Lebedyuk · Aug 9, 2016 2m read

Process-private Globals  can be used as a data global in storage definition. That way, each process can have its own objects for the class with ppg storage. For example lets define a pool, which can:

  • add elements to a pool (ignoring duplicates)
  • check if an element exists in the pool

Here's the class:

2
0 990
Question Scott Beeson · Aug 4, 2016

Using Node.js with Caché - Introduction says the following:

The cache.node module is the Node.js interface for the GlobalsDB kit, which can be obtained from the GlobalsDB download page (http://globalsdb.org/downloads/). The Node.js interface can be used with either Caché or the free GlobalsDB database.
The installation kit includes detailed documentation on how to install and configure the cache.node module.

However, http://globalsdb.org/downloads gives a 404 and http://globalsdb.org just redirects to intersystems.com

Where can I find the files I need?

3
0 975
Article Alexander Koblov · May 20, 2016 12m read

Order is a necessity for everyone, but not everyone understands it in the same way (Fausto Cercignani)

Disclaimer: This article uses Russian language and Cyrillic alphabet as examples, but is relevant for anyone who uses Caché in a non-English locale.Please note that this article refers mostly to NLS collations, which are different than SQL collations. SQL collations (such as SQLUPPER, SQLSTRING, EXACT which means no collation, TRUNCATE, etc.) are actual functions that are explicitly applied to some values, and whose results are sometimes explicitly stored in the global subscripts. When stored in subscripts, these values would naturally follow the NLS collation in effect (“SQL and NLS Collations”).

7
1 3115
Question Timothy Leavitt · Mar 2, 2016

Is the default language (i.e., $$$DefaultLanguage, which is used as the basis for localization with $$$Text/etc. at compile time) always "en" for new Caché installations, or could it be different? How is this determined? I don't see an option to select a language during Caché installation.

Also, is there a supported/preferred API for setting the default language? Looking at %occMessages.inc, one option would be:

Set $$$DefaultLanguageNode = "en"

But I'd expect there to be a classmethod for this somewhere (and haven't managed to find it yet).

3
0 586