spartacus
11th June 2003, 17:01
Hi all,
What is the best way, to export some data CONTAINING TEXTNUMBERS from one system to another using Exchange?
Spartacus
lbencic
11th June 2003, 17:14
well, the numbers would come over with a regular exchange on that field, but you want to get the text too, which is stored in a separate table.
You can find the quick guide for this on the baan support site - search for 'quick guide exchange' and it will come up.
estotz
11th June 2003, 18:19
Easiest way is to export it with exchange using multi-line format and then importing it with exchange on the other end using the same multi-line format.
Make sure the text group that you created the text with exists on the target server and that the user doing the import has the same default text group defined.
Advantage of using multi-line format is that the text manager handles the numbering of the texts etc. If you were to use the numeric option then there are many more considerations.
spartacus
12th June 2003, 10:45
Thank you all, for your help.
I found a document called "Exchange - Multi-line Text". Hope this is what you meant ?
If I understand right, the trick is to export/import in multi-line format.
Based on this a think, the generated ASCII file contains no textnumber, but the text itself.
With import, I think, this text will be imported, and a NEW text number is generated?
But if a new textnumber is generated, that means, if however, one text (the same number) is present in different tables, this relation will be lost?
Spartacus
lbencic
12th June 2003, 17:31
I see what you mean. This would be true I guess unless you pay special attention. Probably you can:
1. Import main table, creates new text numbers in the new company.
2. Import secondary table. Don't create new text, instead read the record from step 1 and use that text number to fill your text fields.
Another option if they are on the same system is to share the text up, so you don't have to recreate in the new company. I don't know if that's right for your setup though.
spartacus
12th June 2003, 20:29
This is a possiblity, I can think over. At the moment I'm not sure, if this a little bit comlicate way is necessary.
Perhaps it will be also a good idea to create a protcol of changed textnumbers, so that in case of trouble it will be possible to compare the new with the old situation.
Spartacus
NvanBeest
13th June 2003, 14:33
Why not use the text functions provided? At least, in BaanIV they work perfectly! As per the following code, which is part of an exchange condition for updating service orders:
function long update_text(domain tcorno _orno, long lines, string buffer(,))
{
string tfld(17) | Name of textfield
string tgrp(8) | Name of textgroup
string stmp(256) | Name of temp file
string topt(15) | "Edit_options" for textfield
string kwd1(17) | Keyword 1
string kwd2(17) | Keyword 3
string kwd3(17) | Keyword 4
long newt | New text?
long i | Iterator
|* Update the service order
db.retry.point()
select tssma301.txtb
from tssma301 for update
where tssma301._index1 = {:_orno}
selectdo
tfld = "tssma301.txtb"
if tssma301.txtb = 0 then
newt = true
endif
|* Read the defaults of the textfield
i = text.defaults(tfld, tgrp, topt)
if i = -2 then
return(-1)
endif
if isspace(tgrp) then
|* Use the default text group
tgrp = "text"
endif
kwd1 = read_ttadv140("tssma301.orno")
kwd2 = read_ttadv140(tfld)
kwd3 = sprintf$("%-d", orno)
|* Write the buffer to a temporary file
stmp = creat.tmp.file$(getenv$("BSE_TMP"))
ftmp = seq.open(stmp, "w")
for i = 1 to tlin
seq.puts(strip$(sbuf(1, i)), ftmp)
endfor
seq.close(ftmp)
if newt then
text.write(tfld, language$, kwd1, kwd2, kwd3, "", tgrp, topt, stmp)
else
text.rewrite(tfld, language$, kwd1, kwd2, kwd3, "", tgrp, topt, stmp)
endif
|* Remove the temporary file
ftmp = seq.open(stmp, "w")
seq.unlink(stmp)
db.update(ttssma301, db.retry)
selectempty
|* Order not found
return(-1)
endselect
commit.transaction()
return(0)
}
function domain tttxt.kwrd read_ttadv140(domain ttadv.clab clab)
{
table tttadv140 | Labels by package VRC
domain tttxt.kwrd rslt | Result (of function)
select ttadv140.desc, ttadv140._index2
from ttadv140
where ttadv140._index2 = {:language$, "ts", "B40 ", "c4", " ", :clab, 1}
and ttadv140._compnr = 0
order by
ttadv140._index2 desc as set with 1 rows
selectdo
rslt = ttadv140.desc
selectempty
rslt = "Unknown"
endselect
return(rslt)
}
Regards,
Nico
NPRao
13th June 2003, 20:53
Nico,
Spartacus is working with BaaN-5 series. Hence your solution would not
work because there have been changes with the Label handling logic in
BaaN with the introduction of LTS (Language Translation System).
The table ttadv140 table structure is changed now with the introduction
of the field - Context of Label which is part of the indexes.
Also refer to the tools dll - ttdlllabels for various functions.
long getlabel( domain ttaad.clan clan.i, domain ttadv.cpac cpac.i,
domain ttadv.clab clab.i, ref domain ttadv.llen leng.io,
ref domain ttadv.lhgt lhgt.io, ref domain ttadv.vers vers.io,
ref domain ttadv.rele rele.io, ref domain ttadv.cust cust.io,
[ domain ttadv.cont context ], [ ref domain ttcdes desc mb ],
[ long develop ] )
void search.existing.labels( domain ttaad.clan curr.clan,
domain ttadv.cpac curr.cpac, ref domain ttcdes desc mb,
ref domain ttadv.clab clab, ref domain ttadv.lhgt lhgt,
ref domain ttadv.llen leng, ref long no.matches,
[ domain ttadv.cont cont ] )
long search.label.with.clab( ref domain ttcdes label.desc mb,
long insert.flag, domain ttaad.clan curr.lang, ref long needed.length,
long curr.leng, long curr.lhgt, domain ttadv.clab curr.clab,
domain ttadv.cpac curr.cpac, domain ttadv.vers curr.vers,
domain ttadv.rele curr.rele, domain ttadv.cust curr.cust )