pblancha
11th October 2001, 00:32
Hi,

i'm using text.write in a script and all it does is create an empty message, but the tmp_file is not empty. What i'm doing is:

rc = text.to.buf("tttxt010.ctxt",lang,10,buf)
tmp_file = buf(1,1)

**** this part is working, tmp_file has the info that was
stored in tttxt010.text

rc = text.write("tdsls002.txta","lang","","","","","","",tmp_file)

*** This part is returning the new text number in tdsls002.txta
but the text is empty. tmp_file is not empty

Anybody worked with text.read() and text.write() ?
am i missing something?

thanks

~Vamsi
11th October 2001, 01:52
I am going to take a quick stab at this one. I notice that you are assigning the array buf to tmp_file. You are trying to place the contents of the text into tmp_file instead of a reference to a file on the o/s. If you want this to work the way you are coding, you will need to open the file tmp_file for write and tranfer the contents of buf into it using seq.* functions.

A simpler way would be to use text.copy to acheive the result of transferring the text from one field to another.

richard
29th October 2001, 17:36
I had the same problem before including the text.write in a db.retry, update and commit sentence (of tdsls002).

sllewellyn
30th October 2001, 18:10
The following works for me, but I've never tried tdsls002.

i = text.write("tssma221.itxt", "2", "Contract Installm",
"Invoice Text", tssma221.ccon,
edit$(tssma221.bkyr,"9999") & " - " & edit$(tssma221.cper,"Z9"),
"text", "text", "/var/tmp/tssma221.itxt")

Frans C
30th October 2001, 22:19
> rc = text.to.buf("tttxt010.ctxt",lang,10,buf)
> tmp_file = buf(1,1)
>
> **** this part is working, tmp_file has the info that was
> stored in tttxt010.text

|
|
V
NOW, write this into a tempfile. However, I am not on a BaaN site to properly test the code that will be needed:

long tempfile.seq
string tempfile.name

tempfile.name = creat.tmp.file$(bse.tmp.dir$())
tempfile.seq = seq.open(tempfile.name,"w")
e = seq.puts(tmp_file,80,tempfile.seq)
seq.close(tempfile.seq)
^
|
|

Change this:

> rc = text.write("tdsls002.txta","lang","","","","","","",tmp_file)

to this:

rc = text.write("tdsls002.txta","lang","","","","","","",
tempfile.name)

Compile & enjoy some good results! :D

lbencic
25th November 2002, 22:22
Just an update on this post.

When you declare tempfile.name, make it

domain tcmcs.str215 tempfile.name


Otherwise declaring it just 'string' will return the first letter in the path of the temp file it creates.