 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Sun Jul 28, 2002 9:31 am
Class Database Variables |
I have a trigger class StockMarket whose scripts generate database variables using the #ADDKEY command. How can I (programmatically) get the generated to belong to the StockMarket class as well?
Asati di tempari! |
|
|
 |
Charbal GURU
Joined: 15 Jun 2001 Posts: 654 Location: USA
|
Posted: Sun Jul 28, 2002 12:44 pm |
In your script, you can use:
#CLASS StockMarket {setdef}
#TRIGGER {Blah} {#ADDKEY Test Field1 123}
#CLASS 0
The setdef makes it so any variables created by the class are made within the class.
Alternatively, you can avoid using the #ADDKEY command for the initialization of the variable and use #VARIABLE instead.
#VARIABLE StockMarketVar %null _nodef "StockMarket"
will create an empty (%null) variable called StockMarketVar in the StockMarket class.
Subsequent references to the variable with #ADDKEY will not change the class it is in.
- Charbal |
|
|
 |
Kjata GURU

Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Jul 28, 2002 12:45 pm |
First create the variable using the
#VAR varName value defValue className
syntax. You may use the special value of _nodef in defValue if you don't want to specify a default.
Then you can use the #ADDKEY command, but make sure that the current class is the one you want by using the #CLASS command like this:
#CLASS StockMarket
After you finish working with this class, you can make the root class the default again by doing:
#CLASS 0
Kjata |
|
|
 |
|
|