Hi All,
I need a little help in understanding how to convert a form from version 6.5 to 
7.6 or 9.1
 
I am trying to write perscriptsions with as little typing as possible
 
I also want Rbase to try to figure out how long a perscription will  last if 
taken correctly.
 
For example, if I write for a drug called Amoxicillin, 1 pill 3 times per day, 
and I give 21 pills, that should last 7 days from today.
 
So...
 
I have a table that has abreviations (shortcut) matched to long names 
(drugname).
 
In this case, the abreviation (I called the column SHORTCUT) is 'AMO' and the 
Drug Name (I called that column drugname) is 'Amoxicillin'.
 
Also....
 
I have a look up table that matches up phrases with "rates of use per day"
 
In this case, the phrase is "3 times per day" and the rate of use (in pills per 
day) is the number 3.
 
In this lookup table, I call the first column (the phrase) FREQ (short for 
frequency) and the second column freqnumb (short for frequency number)
 
So, if I have not lost you yet...
 
In Rbase 6.5, the form has a section for variables, very similar to the 
variable section in 7.7 and 9.1
What worked for me then (not sure if this was the right way to do it), in the 
variable section, I had 
 
column names = expression
 
for example, I had these expressions...
 
drugname = drugname IN scripts WHERE shortcut = .vshortcut 
freq = freq IN drugfreq WHERE drugname CONTAINS .vshortcut
freqnumb = freqnumb IN drugfreq WHERE freq = freq
 
There were similar lookups for the refill number, the quantity of pills, etc
 
These expressions filled the columns with values.
 
Now, in Rbase 7.6 and 9.1, I have much more flexibility with component IDs.
 
My thought was to eliminate the expressions, which never made much sense to me 
since I was using expressions to give data to columns rather than to variables, 
and the section was called VARIABLES.
 
So, on the field for the abreviation, I have an "ON Exit EEP"
This is part of my code for the "On Exit EEP", exiting from the field where I 
typed the abreviation (aka shortcut)
 
--on exit eep
--look up the drugname, frequency, quantity, refill numbers etc and calculate 
how long the script should last 
 
SET V vshorcut_old TEXT 
SET V vshortcut1 TEXT
GETPROPERTY shortcut textvalue vshortcut1
SET EQNULL ON
--make no changes unless the shortcut has been changed
IF vshortcut_old <> .vshortcut1 THEN
  SET V +
  vdrugname = drugname, +
  vfreq = freq, +
  vduration = duration, +
  vdruginst = druginst, +
  vquant = quant, +
  vrefills = refills, +
  vacuteflg = acuteflg, +
  vitemflag = itemflag, +
  vdurdefault = duration_default, +
  vspeccomm = speccomm, +
  IN scripts WHERE drugname CONTAINS .vshortcut1
 
  --get numerical values from the text data that is part of the perscription, 
the data is in several look up tables
  SET V vfreqnumb = freqnumb IN drugfreq WHERE freq = .vfreq
  SET V vquantnum = quantnum IN drugquant WHERE quant = .vquant
  SET V vdurnumb = durnumb IN drugdur WHERE duration = .vduration
  SET V vrefnumb = refnumb IN drugrefs WHERE refills = .vrefills
 
  --now update all the column values from the above varialbles
  PROPERTY namedose textvalue .vnamedose
  PROPERTY freq textvalue .vfreq
  PROPERTY freqnumb textvalue .vfreqnumb
  PROPERTY DURATION textvalue .vduration
  PROPERTY druginst textvalue .vdruginst
  PROPERTY quant textvalue .vquant
  PROPERTY quantnum textvalue .vquantnum
  PROPERTY refills textvalue .vrefills
  PROPERTY acuteflg textvalue .vacuteflg
  PROPERTY itemflag textvalue .vitemflag
  PROPERTY duration_default textvalue .vdurdefault
  PROPERTY durnumb textvalue .vdurnumb
  PROPERTY refnumb textvalue .vrefnumb
  PROPERTY speccomm textvalue .vspeccomm
ENDIF
SET EQNULL OFF
LABEL END
RETURN
 
Seems pretty simple, but none of my column names are getting updated until 
after I save the row.
What happens, some of my rules for the table get violated because there is 
missing data for some of the dependent columns.
I can make it work by using the same expressions I used in Rbase 6.5, but I am 
trying to impove my coding "skill", or lack there of.
 
What is the right way to update the colums using expressions and data obtained 
from lookup tables?
When does the PROPERTY command take effect? only after I save the row, or after 
the cursor leaves the row?
 
Sorry to be soooo long winded....but I really don't know how to break down my 
issue any smaller.
 
Thanks for reading
Mike

Reply via email to