/Demo-PassingVars

A simple demo of passing variables between Caché ObjectScript classes and Routines

Primary LanguageApex

Demo-PassingVars

A simple variable scoping demo of passing variables between Intersystems Caché ObjectScript classes and Routines.

In this scenario you are not allowed to modify the EXISTINGCODE routine but you want to obtain the variables set within it. To do this, we have created intermediate routines called INTERVARS1 and INTERVARS2. These pass variables back to the Cache ObjectScript Run() ClassMethod (static method in other languages).

While this was designed to be run from the shell, you could easily extend the %CSP.REST class and add web service config to return a JSON object instead.

Instructions

  • Import the code into a clean namespace. On fresh installations, USER is ideal.
  • From the shell Set status = ##class(PassingVars.Demo1).Run()
  • From the shell ZWrite ^LOG