> Mike makes a good point and you must consider multi user implications.
> However, that is the reason why I would probably use the table
> in the database. The same issues will apply if you write to an
> external file or to a table. I believe however, that there are a lot
> of options available to you with the table process. Built in
> record locking, time stamps easily implemented, last user
> to use the variable, last program to use the variable, the list
> could go on and on, depending on what all you wanted to
I use a stored procedure called Sp_GetTemp that returns the "Users" temporary
directory. I didn't complicate my example with the addition of this just for
simplicity. In a Multi User (even Multiple Users per machine are covered by
any of the W2k and greater machines as each user gets its' own Temp Directory)
environ, the users Temp directory is safe from any overwrites by other users,
so:
* Explanation of the stored Procedure. Sp_GetTemp test for trailing '\'
because of the difference in the way ENVVAL('TEMP') is reported between the
Win9.x and the NT group OSes.
If you want to save variables, write them to a Startup file that is always read
by the session Application. I write them like:
Say the value of vSomeTextVar is 'The Value Of the Variable' and the value of
another vSomeIntVar Integer is 234, So:
Set var vOutputFile = ((Call Sp_GetTemp()) + 'SomeStartupFile.rmd')
SET VAR vsometextvar = 'The Text Var Value'
SET VAR vsomeintvar = 234
OUTPUT &vOutputFile
SET VAR vtext = ('Set Var vSomeTextVar Text = ''' + .vsometextvar + '''')
WRITE .vtext
SET VAR vtext = ('Set Var vSomeIntVar Int =' & (CTXT(.vsomeintvar)) + '')
WRITE .vtext
WRITE 'Return'
OUTPUT SCREEN
RETURN
When the next session starts and executes the SomeStartupFile.rmd file, the
values of the Variables will be preserved. Time stamps, or whatever info you
want to keep can be saved via the same method.
I actually started this scenario about five years ago when I wanted to get the
results of a Script File passed back to RBase. I would create the file with
the Set Vars in it and then Run it in the RBase environment getting the result
that way..
Finally we got WinUDF that allowed the passing directly to a variable. The
original method, however, was still viable as it allows the passing of Many
variables.