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) te worden opgezocht en bewaard in R:BASE.



   Marco

----- Original Message -----
     From: Luc Delcoigne

     To: Marco Groeneveld

     Sent: Tuesday, August 24, 2010 2:21 PM

     Subject: Fw: converting DOC2RTF







     From: Luc Delcoigne

     Sent: Tuesday, August 24, 2010 2:14 PM

     To: [email protected]

     Subject: Fw: converting DOC2RTF





     Marco and Mike,



     I tried the vbs script and it works indeed.

     This solves already part of my problem.



Marco, in your example, did you load the rtf-files manually into the BLOB ?



the only problem is that the script has to be placed in the same directory as the files to convert, although the code apparently could let me pass an argument.

But when run with the Launch command in Rbase, it doesn't accept parameters.



     What I'm looking for is the following:



     1. All my radiology reports are in one directory 'c:\Protocol'

2. For each patient a folder is created in this directory. The name of the folder is the PatID of the patient in the database ..E.G. c:\Protocol\600829DL00

3. Each reports is named according to the consultnummer of that patient and is placed in the correct patient-folder. e.g. c:\Protocol\600829DL00\10082401.doc



I need to find a way to loop through the table consult. In this table I have a Patid and a consultnummer on each row.

With those two parameters I am able to retrieve each associated report.



4. Then I have to run the Doc2rtf vbs on the report of each patient-folder in the Protocol-directory.



5. Once I have the converted report I have to load it automatically into the ProtocolBLOB in the Consult-table.



So I have to be able to loop through the Consult-table, put the patID and consultnummer into a variable, check if there is an associated folder and file based on those variables, run the Doc2Rtf on the report of that consultation and update it in the BLOB of the consult-table with the right consultnummer.



     Luc D.


Reply via email to