First Rule of While Loops. Don't Declare or use the Declare Form of a
variable inside the while loop. Declare them before the start of the
loop
like:
SET VAR vprot text =null
SET VAR vprot1 varchar = null
SET VAR vcount INTEGER=0
-- then your while loop code
WHENEVER NOT FOUND GOTO errors
CLOSE cur1
DROP CURSOR cur1
DECLARE cur1 CURSOR FOR SELECT consultnummer, punieknummer FROM
consult
WHERE punieknummer = '460114RC00' ORDER BY consultnummer
OPEN cur1
FETCH cur1 INTO vconsult IND vi1, vpunieknummer IND vi2
WHILE SQLCODE <>100 THEN
SET VAR vcount = (.vcount+1)
--SET VAR vprot = ('c:\protocol\' + .vpunieknummer + '\' + .vconsult)
--SET VAR vprot1 = [.vprot + '.rtf']
set var vprot1 = ['c:\protocol\460114RC00\01080222.rtf']
UPDATE consult SET protocolblob = .vprot1 WHERE consultnummer =
.vconsult
FETCH cur1 INTO vconsult IND vi1, vpunieknummer IND vi2
ENDWHILE
CLOSE cur1
DROP CURSOR cur1
RETURN
LABEL errors
CLOSE cur1
DROP CURSOR cur1
RETURN
----- Original Message -----
From: "Luc Delcoigne" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Tuesday, August 24, 2010 4:11 PM
Subject: [RBASE-L] - Re: converting DOC2RTF
Emmitt,
I still have got a problem with the uploading of the file content in
the
BLOB field.
I made the following code :
'
WHENEVER NOT FOUND GOTO errors
CLOSE cur1
DROP CURSOR cur1
DECLARE cur1 CURSOR FOR SELECT consultnummer, punieknummer FROM
consult
WHERE punieknummer = '460114RC00' ORDER BY consultnummer
OPEN cur1
FETCH cur1 INTO vconsult IND vi1, vpunieknummer IND vi2
SET VAR vcount INTEGER=0
WHILE SQLCODE <>100 THEN
SET VAR vcount = (.vcount+1)
--SET VAR vprot text = ('c:\protocol\' + .vpunieknummer + '\' +
.vconsult)
--SET VAR vprot1 varchar = [.vprot + '.rtf']
set var vprot1 varchar = ['c:\protocol\460114RC00\01080222.rtf']
UPDATE consult SET protocolblob = .vprot1 WHERE consultnummer =
.vconsult
FETCH cur1 INTO vconsult IND vi1, vpunieknummer IND vi2
ENDWHILE
CLOSE cur1
DROP CURSOR cur1
RETURN
LABEL errors
CLOSE cur1
DROP CURSOR cur1
RETURN
'
When I put vprot1 = to the filename itself, all goes well and the file
contents is loaded into the BLOB.
However, when I use a variable 'set var vprot1 varchar = .var' I get
a
syntax error.
What am I doing wrong here ?
Luc D.
From: Emmitt Dove
Sent: Tuesday, August 24, 2010 8:50 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: converting DOC2RTF
You can load the content of any external file into an
appropriately-typed
variable using that technique. Just remember, if the file is
character-based, use a varchar; if it is binary, use a varbit.
Emmitt Dove
Manager, Converting Applications Development
Evergreen Packaging, Inc.
[email protected]
(203) 214-5683 m
(203) 643-8022 o
(203) 643-8086 f
[email protected]
From: [email protected] [mailto:[email protected]] On Behalf Of Luc
Delcoigne
Sent: Tuesday, August 24, 2010 13:09
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: converting DOC2RTF
Emmitt,
I owe you my sincere apologies.
YES, your code works....It's all in the square brackets, isn't it !
I omitted them in my first trial.
Sorry about that.
Thanks a lot. I think this will be the final part of my 'import'
problem
solution.
Luc D.
From: Emmitt Dove
Sent: Tuesday, August 24, 2010 6:21 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: converting DOC2RTF
Luc,
SET VAR vx VARCHAR = ['filename.rtf']
UPDATE tablename SET columnname = .vx WHERE .
Emmitt Dove
Manager, Converting Applications Development
Evergreen Packaging, Inc.
[email protected]
(203) 214-5683 m
(203) 643-8022 o
(203) 643-8086 f
[email protected]
From: [email protected] [mailto:[email protected]] On Behalf Of Luc
Delcoigne
Sent: Tuesday, August 24, 2010 10:24
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: converting DOC2RTF
Marco,
I solved 50% of the problem.
the wscript cannot be run with parameters in Rbase when using the
Launch-command.
However it works very well when using the ZIP ROLLOUT command.
Here I can pass the variables and retrieve the .doc and convert it to
.rtf
in the same folder.
Now all I have to do is find a way to automatically load this RTF in
the
BLOB field of my Rbase table.
Any thoughts how to do this ?
Luc D.
From: Marco Groeneveld
Sent: Tuesday, August 24, 2010 2:56 PM
To: Luc Delcoigne
Subject: Re: converting DOC2RTF
maakt me niet zo veel uit. Anders beiden. Mogelijk dat dit te
combineren
valt. Tenzij je ook in Rbase het pad naar de doc files hebt (oude
methode
in Access)
----- Original Message -----
From: Luc Delcoigne
To: Marco Groeneveld
Sent: Tuesday, August 24, 2010 2:54 PM
Subject: Re: converting DOC2RTF
Wil je de access tabel of de Rbase tabel ?
From: Marco Groeneveld
Sent: Tuesday, August 24, 2010 2:51 PM
To: Luc Delcoigne
Subject: Re: converting DOC2RTF
is punieknummer het id van de record in access / rbase of heb je nog
een
ander id met oplopend nr ?
heb je anders de tabel voor me dan kan ik het een en ander nabootsen
(een
eenvoudige voorbeeld met bv 3 record is ook prima.
----- Original Message -----
From: Luc Delcoigne
To: Marco Groeneveld
Sent: Tuesday, August 24, 2010 2:49 PM
Subject: Re: converting DOC2RTF
Marco,
die tabel heb ik zowel in Access als in Rbase, telkens met het
punieknummer en het consultnummer.
De vraag is hoe kan ik dat optimaal optimaliseren door de tabel
Consult
te doorlopen en de rtf 's automatisch te laden in de BLOB van het
juist
record van de Consult-tabel in Rbase.
Luc D.
From: Marco Groeneveld
Sent: Tuesday, August 24, 2010 2:34 PM
To: Luc Delcoigne
Subject: Re: converting DOC2RTF
Luc,
Wat heb je nu in Access staan ? kan daar niet iets worden
voorbewerkt
zodat er al een duidelijke tabel aanwezig is, waarbij de patientid and
consultid bekend is, dan hoeft er slechts het bijbehorende doc (nu
rtf)