SandraDiehl
29th March 2007, 23:27
I'm having some slight issues with using the text.write function. Could use any advise please.

This is what I am doing: I have an ASCII input file that contains an item and description. I am reading it into my script and selecting from tiitm001 where the items are equal. The goal is to write the description from the file to
tiitm001.txtp (AKA The Purchase Text). We have text group "text" defined in the system, align.item is the item read in and buf.dsca is the description. Then I want to copy the text I created in the English lang to Spanish lang.

This what my code looks like:

db.retry.point()
select tiitm001.*
from tiitm001 for update
where tiitm001._index1 = {:align.item}
order by tiitm001._index1
selectdo
ret.num = text.write("tiitm001.txtp", "2", "ITEMLOAD",
"ITM001.TXTP", buf.item, "", "text",
"3", buf.dsca)
ret.num = text.copy.language(tiitm001.txtp, "2", "5")
db.update(ttiitm001, db.retry)
endselect
commit.transaction()


When I run this I get tiitm001.txtp has a value other than zero but my ret.num = 0 which from what I have read means no lines were created since the return value should reflect how many lines were written.

Any ideas what I am doing wrong???

Thanks:confused:

mark_h
30th March 2007, 00:40
write.return = text.write(some.field, "2", kw1, kw2, kw3, kw4, "purchase", "", temp.file1)

This is from a program I know works - I can not remember the problem I had with eopt, but I ended up making it "". Is your buf.dsca a file name or an array? In my case kw1 thru kw4 are set with a text read from another text group.

Never used the text.copy.language function.

SandraDiehl
30th March 2007, 15:06
I changed the eopt arguement to contain "" and still get the same results. I get an assigned text number that gets placed into tiitm001.txtp (ex: 10), but when I look out in table tttxt010 it's not getting inserted.

To answer your question my buf.dsca is an array of 256 so basically my data that is coming in looks like this:

255-37-0418|This is a long description for item 255-37-0418

So I read the 255-37-0418 into align.item and the buf.dsca gets the rest minus the |.

The rest of the arguements, Kkw1 - kw4, I was understanding those are the KeyWords that you use for a search hence the reason why I have the values I have.

My only other thought is that the parm "tgroup" is defined as string 8 and I found issues many of times with BaaN you have to set up the sting to contain all 8 characters, rather if right or left justify so I wonder if this is the same case?

mark_h
30th March 2007, 15:26
Put the text into a temporary file and try putting the filename in the last option of text.write. This option is the name of the file that contains the text for the new field.