marine
14th February 2007, 02:34
I have searched the board for this, but must not be using the right keywords...

I have seen the exchange scheme threads for importing mulit-line text, but I would like to add some code to an existing session that imports records from a ASCII text file.

This code would import a long string from this text file and create a Text record from it (appropriately creating & associating the correct text number in the main table that I am inserting records for).

Please point me in the right direction if this has already been discussed....
If not, has anyone done this before?

Thanks in advance,
-Marine

PS - since I'm on the topic, how about a "nice" way to export the multi-line text to an ASCII file?

pellus
14th February 2007, 22:44
At least in SSA LN.
File to text: program function "text.write" does the insertion of the text. Needs normally some info that is retrieved by preceding "text.defaults".

en@frrom
15th February 2007, 10:26
I have used the text.write function several times for adding text fields. The thing is that if your text string is only a PART of the ascii file, you will have to first create a new (temp-) file with only the text string, and for that file call text.write. Below I give you an example:


ret = seq.gets(text.str,1024,fileid)
text.str = strip$(shiftl$(text.str))
if not isspace(text.str) then
temp.file = creat.tmp.file$(bse.tmp.dir$())
fp = seq.open(temp.file,"w")
if fp >= 1 then
retval = seq.puts(text.str, fp)
retval = seq.close(fp)
retval = text.write("<table_textfield>", language$, "<Keyword1>", "<Keyword2>",
"<Keyword3>", "<Keyword4>", "<text group>", "<window type>", temp.file)
if retval > 0 then
db.update(<table_name>, db.retry)
commit.transaction()
endif
endif
endif


Good luck!

Regards,
Eli Nager