· Aug 17, 2023 1m read

Download Globals as XML using CSP

Inspired by a Question from @Evgeny Shvarov and a Reply from @Ashok Kumar
I have created a base for Global download as XML file

How to use:
just call the page like http://<your_server>/csp/samples2/dc.Gdown.cls?GBL=global_name

gbl-name  without the initial ^ (caret)

The output has a default name <global_name>.XML  Your choice is available.

Known Limits:

  • you have to install it at your sourcing server
  • it is not tested/working across namespaces
  • there is no partial download
  • error handling is just basic or missing

There is space for personal improvements.

and this is it:

Class dc.Gdown Extends %CSP.Page

ClassMethod OnPreHTTP() As %Boolean [ ServerOnly = 1 ]
  #dim %response as %CSP.Response
  set %rcc=$Get(%request.Data("GBL",1),"")
  if %rcc]"" {
    set %rcd=$D(@("^"_%rcc))
    if %rcd {
      set %response.ContentType="application/xml"
      set %response.Headers("Content-Disposition")="attachment; filename="""_%rcc_".xml"""
  else  { 
    set %rcd=0
    set %rcc="Parameter GBL"
  quit $$$OK

ClassMethod OnPage() As %Status
  if '%rcd {
   #(%rcc)# &gt;&gt; not found </body></html>>
  quit $$$OK
  do $system.OBJ.Export(%rcc_".GBL")
  Quit $$$OK



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