schreddermaus
12th July 2010, 09:48
Hi,
can somebody help me?
I want to copy a description field into another description field within a multi language environment. Field A is a multibyte string with 30 characters an field B is a multibyte string with 50 characters. Now I want to write the value of field A into field B. But this doesn't work. I just get an out of range error if I try to save field B.
I there a trick I have to know for multi language environments?
schreddermaus
12th July 2010, 18:11
Or is it possible to read a dataset for a specific language like reading the dataset of a specific company by adding a line in the select where clause like "table123._compnr = 100"?
Juergen
13th July 2010, 09:55
Hi,
please check the keyword "ml_one_lang" in the ERP programmers guide.With the ml_one_lang function you can select a single data language from a Multi Language Field.
Regards,
Juergen
bdittmar
13th July 2010, 13:24
Or is it possible to read a dataset for a specific language like reading the dataset of a specific company by adding a line in the select where clause like "table123._compnr = 100"?
Hello,
if PGuide is not available:
ml_one_lang function
With the ml_one_lang function you can select a single data language from a Multi Language Field (MLF). An MLF is a column which is configured to have multiple data languages.
When it is not necessary to retrieve all languages and a statement is very critical for performance it is possible to use this function, to avoid selecting the translations from the database. Do not do this in cases where the selected data is later inserted into the database, because this will lead to loss of the other translations of the value.
Syntax
<ml_one_lang function>
::= ml_one_lang ( <column>, [ <data language> | <parameter>] )
<column>
::= Column reference
<data language>
::= String constant
<parameter>
::= ParameterSyntactical restrictions
The <data language> (either as a constant or as a parameter) shall be a Data Language code in ISO 639-2 format, like "eng" for English, or "dut" for Dutch.
Semantics
If the column reference is not a Multi Language Field (MLF) then the function ml_one_lang returns the column value.
If <string constant> is omitted then the implicit string constant is the current data language of the user.
Examples
The following ml_one_lang function returns the current language value of the column dscr.
select ml_one_lang(a.dscr) from dbtst100 a where a.id = 10
The following ml_one_lang function returns the french language value of the column dscr.
select ml_one_lang(a.dscr, 'fre') from dbtst100 a where a.id = 10
Regards
schreddermaus
14th July 2010, 12:10
I get an unresolved reference to function 'ml_one_lang' error.
Do I need to include something?
Juergen
14th July 2010, 14:34
Hi,
enclosed a quick example to read the item desc. in the data language English (en_GB):
function read.item.lang.eng (domain tcitem item.i)
{
string ret.l.dsca(35)
select tcibd001.item, ml_one_lang(tcibd001.dsca,'en_GB'):ret.l.dsca
from tcibd001
where tcibd001._index1 = {:item.i}
order by tcibd001._index1
selectdo
endselect
}
schreddermaus
14th July 2010, 17:59
sorry, I get the same error as before. The description is read, but if I want to save it in another description field an out of range error occurs
string tmp.ort(30)
db.retry.point()
select ml_one_lang(tccom139.dsca):tmp.ort
from tccom139
where tccom139._index1 = {:tccom130.ccty, :tccom130.cste, :tccom130.ccit}
as set with 1 rows
selectdo
tsbsc100.desc = tmp.ort
endselect
...
db.insert(ttsbsc100, db.retry)
commit.transaction()