· Jul 21, 2021

What is the best way to export a global or a table to a file?

in order to do analysis on huge data volumes, it is better to take you data to a separate machine for analysis away from the operational machine, so trying to write huge globals or tables into files as is would take a huge space, what could be a solution or best practice ? python for instance, there is the pickling option (serializes data to byte string and saves it to a file) to save space, what could be best in object script ?

Discussion (11)2
Log in or sign up to continue
  1. Whatever you do it affects the operational machine as you have to read through the whole Table/Global
  2. For Table it can be a simple SELECT * FROM TABLE  with the option to select columns of interest
  3. For Global  use $system.OBJ.Export(<globalname>.GBL,<filename>)  as XML.

 Of course, if you have a Shadow instance of your operational machine you can do it there and avoid the load on the primary machine.
Eventually, you can run there all analyses without export at all.

One more question if I may: I try to exclude global subnodes but so far unsuccessfully. Is it possible?
This correctly exports the corresponding node only:  items("SOMEGLOBAL(""ABC"",""XYZ"",""USERFORM_ATEST"").GBL") = ""
Now if I try to exclude this node from the SOMEGLOBAL like this,  items("SOMEGLOBAL.GBL",'"SOMEGLOBAL(""ABC"",""XYZ"",""USERFORM_ATEST"").GBL") = "", it does not exclude it. There is a barely visible single negating quote in the beginning of the second item.

I don't think this syntax works. I think the exclusion is for matching against wild cards, for example if you wanted to export all the globals called some*.gbl but exclude one or more of them. I don't think it deals with subscripts.

You may need to merge your global into a temporary global, kill the subnodes you want to exclude, export, and then merge the temporary global back to restore them. (or something similar)

I understand that this is probably not an option if the data is huge. Maybe InterSystems support (WRC) can help.


As the main objective is not to overload the server any of the solutions presented will overload the production server. Whether performing a backup, exporting data to file, etc. ​Especially if it is a repetitive, constant task with a large volume of data.

If your product license allows it, it is recommended to use a shadow server. Adopting a shadow server will redirect the processing effort from any adopted solution to another machine.