Post Reply 
Deleting Variables
11-09-2016, 08:46 AM (This post was last modified: 11-09-2016 08:58 AM by Didier Lachieze.)
Post: #7
RE: Deleting Variables
(11-07-2016 02:07 AM)BERNARD MICHAUD Wrote:  Does anyone know how to delete a group of variables such as the one created below? Not just the content of the variables.

Normally exported variables are supposed to stay to be available and usable outside of your program. Now if what you want to achieve is to have them created and visible only when you want to run a specific application composed of a set of programs, this can be done programmatically by putting all exported variables in a separate program dynamically created.

Here an example which creates a program called “GlobVars” with 3 exported variables, after that the exported variables exist and are available. If you call it a second time it will delete “GlobVars” and the exported variables.

Code:
EXPORT TestGlobVars()
BEGIN
LOCAL prog;

prog:="EXPORT AB;
EXPORT BC;
EXPORT CD;";

IF POS(Programs,"GlobVars")==0 THEN 
  Programs("GlobVars"):=prog;
ELSE
  Programs("GlobVars"):="";
END;

END;

EDIT: note that it will make checking and compiling your program a bit tricky as the global variables should exist at that time.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Deleting Variables - BERNARD MICHAUD - 11-07-2016, 02:07 AM
RE: Deleting Variables - Carlos295pz - 11-08-2016, 03:47 AM
RE: Deleting Variables - BERNARD MICHAUD - 11-09-2016, 02:45 AM
RE: Deleting Variables - eried - 11-09-2016, 06:31 AM
RE: Deleting Variables - Didier Lachieze - 11-09-2016 08:46 AM
RE: Deleting Variables - BERNARD MICHAUD - 11-10-2016, 02:18 AM



User(s) browsing this thread: 1 Guest(s)