Hi Bill,
It took a while for me to have the time to study this.  I think the &var is 
what I was looking for to use in my "while" loop.  (I tried .var, #var, %var - 
I didn't think of &var.)  I may use this instead of doing it the correct way 
with the normalized table, because of time constraints.  

Rbase is loaded on a different computer here, so I didn't try it yet.  But I 
believe what you're saying is:
if my variable vCommand is set to a string that looks like a command, 
and if I have &vCommand as a line of code, it will perform the command
 
Thank you so much,
Patti

--- On Tue, 6/7/11, Bill Downall <[email protected]> wrote:


From: Bill Downall <[email protected]>
Subject: [RBASE-L] - Re: need Array logic
To: "RBASE-L Mailing List" <[email protected]>
Date: Tuesday, June 7, 2011, 6:35 PM


Patti,


Here's a simplified snippet that has R:BASE create a SET VAR command and 
execute it:


-- presuming you have one variable, vVarName, that holds a variable name, and 
another, vVarValue, that holds an integer value looked up in a table:


SET VAR vCommand = ('SET VAR' & .vVarName & 'INTEGER =' & ctxt(.vVarValue))
&vCommand


vCommand has a value that looks like:
SET VAR MyVar INTEGER = 1

The "&" form of a variable reference tells R:BASE to just substitute the whole 
thing as a command or part of a command, rather than trying to evaluate it.


If you actually store Y and N, then it is a text variable:



SET VAR vCommand = ('SET VAR' & .vVarName & 'TEXT =' & '''' + .vVarValue + '''')
&vCommand

vCommand looks like:
SET VAR myVar TEXT = 'Y'


In the SET VAR command that creates the SET VAR command, to put the quotation 
marks in you have to double the quote mark to "escape" it, and then surround 
the escaped quote mark with quote marks, so it takes four in a row to make a 
single quote in the resulting variable.


Bill



On Tue, Jun 7, 2011 at 2:22 PM, Patti Jakusz <[email protected]> wrote:



Hi Bill,
I'll have to get my code into a more readable form before posting it.  (I may 
not get a chance again until tomorrow.)
 
I thought about doing the "narrow" table as you suggested (kind of a cross 
between your two methods), but I will have to build a "wide" table anyway, for 
sending data to other health depts.  I was hoping to only have the wide one - 
but maybe it will be easier to have it both ways.  
Patti

Reply via email to