I have developed a real time save/headache solver...
I have time after time run into forms that would not run
because of a variable not being predeclared and yes I know
it's good programming to do so.... so I hated having to
copy out rbase's list of vars for a form and then copy and
paste in SET VAR and so on. I decided to do something about
it. I have created 3 small script files that will pick up
the list of vars place the SET VAR in front the var name along
with the correct datatype setting it to null and place it all
on the clipboard so all you have to do is type in a couple of
RUN statements, a few clicks and paste the code right into you
app...
Keep in mind this will only work with RBase newest with inline
patches applied or possibly without the patches, but haven't
tried. For those on older version you could change the output
method I am using and save this to a file.
Here is how it works:
1. You must have a table in your database called Dummy with at
least on column(name or size doesn't matter but I think it
should be a text datatype.. haven't tested this part) WITH
ONE ROW OF DATA in it... doesn't matter what the data is..
2. Connect to the database the form is in.
At the R prompt type ... RUN vlist.rmd
3. This will present you a list of 3 choices. Choose '1) Run Step One'.
This will show a list of forms in the database, just pick the
form you need the list of vars for.
This will prompt you to make sure and Open up form in design mode.
You will have to choose 'Quit' first.
4. Go to the Object Manager and open up the form in design mode.
Then without doing anything close the form you just opened -
either by [X] to close the form (not Rbase) or by choosing the
menu File ... Close Window.
5. Now return to R prompt and type RUN vlist.rmd again (or press
page up button to get the last commnd) and run this choosing
the '2) Run Step Two' option and then '3) Quit'
6. The variables are now created and sent to the windows clipboard
so you can paste them into your code now.
ENJOY.....
Here are there files:
IN this format...
filename to save it as
blank line
code to copy into the file name above and to save.
blank line
RB_EOF... do not copy this line it just tells you where this file stops.
vlist.rmd
*(
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
PROGRAM NAME: vlist.rmd
AUTHOR: Jim Limburg
Tuftco Corporation
2318 Holtzclaw Ave, Chattanooga, TN 37404
Voice: 423-698-8601 Fax: 423-698-0842
email: [EMAIL PROTECTED] --business
[EMAIL PROTECTED] --home
PURPOSE: Capture the variables needed to run a form.
Will set the clipboard to a list of SET VAR
statements that a form needs to have preset
before running
IS RUN BY: Be connected to the database you are working
with and then type at R> prompt: RUN vlist.rmd
Run the First Step and Quit. This will tell you
to Open the form in design mode -- Do this by
going to the Manager where reports,forms,and
tables are created and go to the forms tab and
click on (highlight) the form you are working on
and click the design button. Immediatly close the
form (yes with doing anything) and then RUN vlist.rmd
again and choose the second option and Quit.
Now you can (paste) the SET VAR statements this
creates into your code pressing [CTRL] + [V] or
right click place you want the code to be placed
and choose paste, or choose paste from the menu
option you have in the program you are writing code
to.
RETURNS: Sets the Clipboard to a list of variables
that can be pasted into your code before a form call.
MODIFICATION HISTORY
Created: 02/12/2002
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
)
LABEL lbtop
CHOOSE vaction FROM #VALUES FOR ('1. Run Step One'), '1' FROM dummy +
UNION SELECT ('2. Run Step Two'), '2' FROM dummy +
UNION SELECT ('3. Quit'), '3' FROM dummy +
AT 15 CENTER TITLE 'Choose Next Action'
SWITCH (.vaction)
CASE 1
RUN lstvars1.rmd
BREAK
CASE 2
RUN lstvars2.rmd
BREAK
CASE 3
CASE '[Esc]'
CLEAR ALL VAR EXCEPT vm_formname
GOTO lbexit
BREAK
ENDSW
GOTO lbtop
LABEL lbexit
RETURN
RB_EOF
lstvars1.rmd
*(
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
PROGRAM NAME: lstvars1.rmd
AUTHOR: Jim Limburg
Tuftco Corporation
2318 Holtzclaw Ave, Chattanooga, TN 37404
Voice: 423-698-8601 Fax: 423-698-0842
email: [EMAIL PROTECTED] --business
[EMAIL PROTECTED] --home
PURPOSE: Part of the vlist.rmd -- see it's comments
IS RUN BY: Part of the vlist.rmd -- see it's comments
RETURNS: Part of the vlist.rmd -- see it's comments
MODIFICATION HISTORY
Created: 02/12/2002
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
)
CLEAR ALL VARIABLES
SET ERROR VARIABLE errvar
CHOOSE vm_formname FROM #FORMS
IF errvar = 0 AND vm_formname IS NOT NULL AND vm_formname <> '[Esc]' THEN
SET VAR vm_msg1 TEXT = +
('Be sure to Open ' + .vm_formname)
SET VAR vm_msg2 TEXT = +
(' form in Design mode, and close it.')
SET VAR vm_msg TEXT = (.vm_msg1 + .vm_msg2)
PAUSE 1 USING .vm_msg AT CENTER CENTER
ENDIF
CLEAR VAR vm_ms%
CLS
RETURN
RB_EOF
lstvars2.rmd
*(
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
PROGRAM NAME: lstvars2.rmd
AUTHOR: Jim Limburg
Tuftco Corporation
2318 Holtzclaw Ave, Chattanooga, TN 37404
Voice: 423-698-8601 Fax: 423-698-0842
email: [EMAIL PROTECTED] --business
[EMAIL PROTECTED] --home
PURPOSE: Part of the vlist.rmd -- see it's comments
IS RUN BY: Part of the vlist.rmd -- see it's comments
RETURNS: Part of the vlist.rmd -- see it's comments
MODIFICATION HISTORY
Created: 02/12/2002
--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=--=+=-
)
IF vm_formname <> '[Esc]' THEN
CLEAR VAR vm_formname,errvar
OUTPUT formvars.lst
SHOW VAR
OUTPUT SCREEN
DROP TABLE frmvars
CREATE TABLE frmvars (varname TEXT 20, varvalue TEXT 42, vartype TEXT 10)
LOAD frmvars FROM formvars.lst +
AS FORMATTED USING varname 1 18, varvalue 22 61, vartype 62 72
CLS
*(This is where it parses the information it has gathered from the
table and creates the file to hold the SET VAR statements.)
SET VAR vm_vars NOTE = NULL
SET ERROR MESSAGES 2077 OFF
ERASE frmvars.txt
SET ERROR MESSAGES 2077 ON
SET ERROR MESSAGES 705 OFF
DROP CURSOR curs1
SET ERROR MESSAGES 705 ON
DECLARE curs1 SCROLL CURSOR FOR SELECT varname, vartype FROM frmvars
OPEN curs1
FETCH FIRST FROM curs1 INTO vm_vname IND vi_1, vm_vtype IND vi_2
SET VAR vm_vnameshort TEXT = (SGET(.vm_vname,5,1))
WHILE SQLCODE <> 100 THEN
SWITCH (.vm_vnameshort)
CASE '#DATE'
CASE '#TIME'
CASE '#PI '
CASE 'SQLCO'
CASE 'SQLST'
CASE '-----'
CASE 'Varia'
BREAK
DEFAULT
--OUTPUT frmvars.txt APPEND
--WRITE 'SET VAR ' .vm_vname .vm_vtype '= ' 'NULL'
--OUTPUT SCREEN
SET VAR vm_vars = (.vm_vars + 'SET VAR ' + .vm_vname + +
' ' + .vm_vtype + ' = NULL' + (CHAR(13)) + (CHAR(10)))
BREAK
ENDSW
FETCH NEXT FROM curs1 INTO vm_vname IND vi_1, vm_vtype IND vi_2
SET VAR vm_vnameshort = (SGET(.vm_vname,5,1))
ENDWHILE
SET CLIPBOARD .vm_vars
DROP CURSOR curs1
ENDIF
DROP TABLE frmvars
SET ERROR MESSAGES 2077 OFF
ERASE frmvars.txt
SET ERROR MESSAGES 2077 ON
CLEAR ALL VAR
CLS
RETURN
RB_EOF
__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/