bluetenders
26th July 2005, 10:10
Hi Everyone!


My script goes this way...

I want to insert this txt1,txt2,txt3,tx4 to the new item that i will insert...

select tibom010.txta
from tibom010
where tibom010.mitm = :tmp.mitm and tibom010.sitm = :item.f
selectdo
text.to.buf("tibom010.txta","2",10,bomtxt)
txt1 = bomtxt(1,1)
txt2 = bomtxt(1,2)
txt3 = bomtxt(1,3)
txt4 = bomtxt(1,4)
endselect

......


select tibom.*
from tibom010 for update
selectdo
|example i will insert Item and text only

tibom010.mitm = "XXXXXXXXXXX"
tibom010.txta = ?????
| for tibom010.txta ???? how can insert txt1,txt2,txt3,txt4
db.insert(ttibom010, db.retry)
commit.transaction()
endselect


Thanks in advance!!!

mr_suleyman
26th July 2005, 11:56
hi , your problem is not clear but As I understand it , you can use following solution

For i=1 to 4
db.retry.point()
if i = 1 then
tibom010.mitm = "XXXXXXXXXXX"
tibom010.txta = text1
endif
if i = 2 then
tibom010.mitm = "XXXXXXXXXXX"
tibom010.txta = text2
endif
******
*****
****** and like that
********************
endif

db.insert(ttibom010,db.retry)
commit.transaction()
endfor


Good luck !

norwim
26th July 2005, 12:29
Hi there:

long TEXT.WRITE( string text_field(17), string lang, string kw1(17), string kw2(17), string kw3(17), string kw4(17), string tgroup(8), string edit_opt(15), string tmp_file(256) [, long bidi] ) The text stored in tmp_file is added to the text manager with the specified text attributes. A new text number is generated and returned in text_field. The number of written lines is returned.

hth

Norebrt

bluetenders
26th July 2005, 13:22
Thanks Mr. suleyman, But what i want is not in that way. this one is like norwim suggestion.
Everytime we insert a new text a unique number is generated. so i cant copy the existing assigned text for every record.

Hi Norwim! can you please help me how to use this "text.write" ... I'm confused if what i should put in.. (Ex... string kw1(17), string kw2(17). etc)
Thanks...

norwim
26th July 2005, 17:34
Hi Blue,

you will have to experiment a little I am afraid.
Use tttxt1112m000 to find out the name of the textgrp that has been assigned to tibom010.txta. Lets assume that this textgrp is called "itmtxt" and that the window for this txtgrp ist called itmwin.
Lets further assume that you use english, which is language 1.
Lets say you use only keyword1 and 2 to find the text, these are set to the itemnumber. Lets further assume that you created a textfile /tmp/file001 which contains 2 lines of text.

So now you could try
long oki
string kt(17)
string kw1(17)
string kw2(17)
string dum(17)
string tg(8)
string wt(15)
string filnam(255)
long txtno

...
...
kt="tibom010.txta"
kw1=tibom010.mitm
kw2=tibom010.sitm
dum=""
tg="itmtxt"
wt="itmwin"
filnam="/tmp/file001"
oki=text.write(kt,"1",kw1,kw2,dum,dum,tg,wt,filnam)
NOW .....
oki should hold a value of 2
and txtno=lval(kt) should give the textnumber
so ...
I am not sure whether you have to do the following :
---------------
tibom010.txta=txtno
db.update or db.insert
---------------
or whether this is done by text.write ... I guess the latter.

good luck, please tell us how things went ... I'm a bit in ahurry, so I can't test this right now, but from memory this should do it.

Of course you can create /tmp/file001 within the program with fopen / fputs / fclose. Take care that you have the authorizations to access the file.

Norbert

dnnslbrwn
1st August 2005, 21:25
I thought English was "2"... did it change in BAAN V?

-Dennis