----- Original Message ----- From: "Luc Delcoigne" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 5:30 PM Subject: [RBASE-L] - re: inserting text in ascii file.
Mike, in attachment you find the 'Medidoc-code' that I wrote to create the ascii-file. The 'fout' file is the file as it is produced now. The 'correct' file is the file as it should be. this is a medidoc-standard, which is a standard over here that lets me communicate my Radiology reports to the referring physicians, so they can collect it automatically in their patient folder. thanks, Luc -------------------------------------------------- From: "Mike Byerley" <[email protected]> Sent: Thursday, July 08, 2010 11:19 PM To: "RBASE-L Mailing List" <[email protected]> Subject: [RBASE-L] - re: inserting text in ascii file.Send me an example text file (direct off list) if you can. Also, show mea dozen or so lines of the code you are using to collect the file contentsinto a variable. Also show any pertenant variable declarations.----- Original Message ----- From: "Luc Delcoigne" <[email protected]>To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 5:06 PM Subject: [RBASE-L] - re: inserting text in ascii file.Mike, i tried your code and I got this : " normale koepelstanden. vrije laterale en dorsale sinussen, zonder tekens van pleuravocht. normale hartgrootte. scherpe aflijning van de hili. normale breedte van het bovenste mediastinum. mediane positie van de trachea.normale aeratie van de longvelden. homogene aeratie van de longvelden, z onder confluerende infiltraten noch verdachte opaciteiten. normale botst ructuren. " Never mind the dutch language, The line-length is OK and is set to 75. but as you see I still get some words that are chopped. How could I solve this ? Luc -------------------------------------------------- From: "Mike Byerley" <[email protected]> Sent: Thursday, July 08, 2010 10:41 PM To: "RBASE-L Mailing List" <[email protected]> Subject: [RBASE-L] - re: inserting text in ascii file.It looks like I wrote it eight years ago to solve a different problem. It just happens it will likely work for yours. You can change the wrap variable to any number and it will insert a CrLf at that location. I can think of another solution to the problem that might be a little quicker. Take the variable that contains the file contents, strip outall of the CrLf, then process from the beginning using some of the logic in the code I sent, the difference being instead of concantenating Noteson the fly, you would add completed lines to a variable user defined ListBox and when you are done, you can use the ListBox's Save_To_File method. If the length of the file contents isn't too long, there might not be such distinguishable difference, so what I sent would probably work without reinventing it all over again.----- Original Message ----- From: "Luc Delcoigne" <[email protected]>To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 4:30 PM Subject: [RBASE-L] - re: inserting text in ascii file.Mike, This is more than just a forum. This is really a place where people help people. I must say that R:base has been so far a heart-warming experience. Thank you. I will try the code immediately. Too hot to go to sleep over here. Luc Delcoigne -------------------------------------------------- From: "Mike Byerley" <[email protected]> Sent: Thursday, July 08, 2010 10:25 PM To: "RBASE-L Mailing List" <[email protected]> Subject: [RBASE-L] - re: inserting text in ascii file.Is the problem that after you have it (the file) converted to a Text variable (is it TEXT or VARCHAR), that the word wrap is beyond 75 characters? If it is, I have some old rbase code that wraps text at a designated maximum width. Also, after you get the DLL, you will be able to process text files any way that is permitted within the VBScript Language. The RBASE CODE: {begin code} LABEL bgprog SET VAR vnote NOTE = (.vVariableOfMyTextFileContents) CLEAR VAR v1,v2,v3,v4,v5,v6,v7,v8 SET VAR vstrtmp NOTE SET VAR vgetlen INTEGER SET VAR vgettext TEXT SET VAR vstrlen INTEGER --the wrap location SET VAR vwrap INTEGER = 75 SET VAR vcrlf = ((CHAR(13))+(CHAR(10))) SET VAR vstrlen = (SLEN(.vnote)) WHILE vstrlen > 0 THEN SET VAR vsloc = .vwrap --test for location of space at wrap point IF (SGET(.vnote,1,.vwrap)) <> ' ' THEN -- loop backwards till find set var vgetlen = .vsloc WHILE (SGET(.vnote,1,.vsloc)) <> ' ' THEN IF (SLEN(.vnote)) <= .vsloc THEN SET VAR vsloc = (SLEN(.vnote)) SET VAR vgetlen = (SLEN(.vnote)) ELSE SET VAR vsloc = (.vsloc - 1) SET VAR vgetlen = .vsloc ENDIF ENDWHILE SET VAR vgettext = (SGET(.vnote,.vgetlen,1)) SET VAR vgettext = (LJS(.vgettext,.vgetlen)) SET VAR vgettext = (STRIM(.vgettext)) SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf) SET VAR vstrlen = (.vstrlen - .vgetlen) IF vstrlen < 0 THEN SET VAR vstrlen = (SLEN(.vnote)) ENDIF SET VAR vnote = (SGET(.vnote,.vstrlen, (.vgetlen + 1))) ELSE SET VAR vgettext = (SGET(.vnote,.vwrap,1)) SET VAR vgettext = (LJS(.vgettext,.vwrap)) SET VAR vgettext = (STRIM(.vgettext)) SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf) SET VAR vstrlen = (.vstrlen - .vwrap) IF vstrlen < 0 THEN SET VAR vstrlen = (SLEN(.vnote)) ENDIF SET VAR vnote = (SGET(.vnote, .vstrlen, (.vwrap + 1))) ENDIF ENDWHILE SET VAR vnote = (SRPL(.vstrtmp,' ', ' ',0)) LABEL ndproc show var vnote=.vwrap at 5 20 CLEAR VAR vcrlf,vgetlen,vgettext,vsloc,vstrlen,vstrtmp,vwrap RETURN {end code}----- Original Message ----- From: "Luc Delcoigne" <[email protected]>To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 4:09 PM Subject: [RBASE-L] - re: inserting text in ascii file. Hi all, I've been sweating all day long on this problem. In a ascii file I have to insert the contents of a rtf- blob. With the RRTFtoTxt pluging I could convert the it to a text variable. Now I can insert the text variable in my file. BUT the lines of the inserted text cannot be longer than 75 characters. This is an essential part of my application. Without this I could be forced to stick with Access where I can manipulate the file with the Wordobj....and I love R:base... Any ideas ?? Grtz Luc Delcoigne

