olabas
17th May 2002, 16:57
I have to create a report printing labels.

To print just one layout in a couple of columns is the best way I know to do that in Baan.
But this single layout must conatain some textfields in different languages.
Of couse of different reasons I have just a textnumber not a real textfield of a table.

So here is my probleme:

Printing just one Layout makes using lattr.textlang$ to switch the language inpossible.

The <bic_text> - functions allways need a tablefield for accessing texts.

Does anybody has an idea how to print texts in differnt languages on one layout?

Han Brinkman
17th May 2002, 17:06
Hi,

You could program it by using the text.to.buf() function, with this function you can read the text into a buffer.

Of course that would mean that you have to handle yourself the number of textlines that has to be printed.

M.fr.Gr.
Han

NPRao
17th May 2002, 20:24
Hi,

You might try this with coding -

Syntax

long text.present.in.language( long textnr, string lang [, ref long nr_lines ] )

Description
This tests whether a specified text is available in a specified language.
Arguments
textnr The text number of the relevant text.
lang The language for which you wish to test the availability of the text.
nr_lines This optional argument returns the number of lines the text occupies in the specified language.
Return values
1 (true) text available in specified language
0 (false) text not available in specified language
Context
3GL library function.

After you verify the text is present in the other language, try to read the text from another language.

long text.read ( string text_field(17), string lang,
ref string kw1(17) mb,ref string kw2(17) mb,ref string kw3(17) mb, ref string kw4(17) mb,ref string tgroup(8),ref string edit_opt(15), string tmp_file(256), long lock )

Description
This reads a specified text and stores it in a temporary file.
Arguments
text_field The name of the text field that must be read. See Text fields: overview. If the text number of the specified field is 0, a subprocess is started, which lists the texts associated with the current company and enables the user to select the text to be read.If no text is found, or if you abort the subprocess, text_field returns 0. Otherwise, it returns the text number of the retrieved text.
lang The language for which the text must be retrieved.
kw1 to kw4 These return the key words associated with the specified text.
tgroup This returns the name of the text group to which the text is assigned.
edit_opt This returns the default window type for the text.
tmp_file The name of the file in which the text must be stored. If this is an empty string, no text is retrieved and the function returns 0.
lock By default, a lock is applied to the text field when it is read. To read the field without lock, set this argument to 0.
Return values
>0 success; returns the number of lines read
0 no text found or subprocess aborted
-1 no permission
Context
3GL library function.

olabas
19th May 2002, 23:39
The argument string text_field(17) is my major problem.
If I am right, text_field has to be the field of a database table.
But I have just the number of the text not the tablefield reffering the text. So I need a function like this:

long get.text( long text_nr, string lang, ref string return_text)

But I havend found anything like this in the online help of Baan.

Let me ask another way:
Is there any way to access a text in Baan just knowing the textnumber an not the tablefield reffering to this text?

NPRao
20th May 2002, 20:36
I think this would work for Texts -


long comp
|* company number - as texts as stored based on company no.
string clan(1)
|* language code
string buffer.line(1024)

comp = 055
buffer.line = ""
clan = "2"

select tttxt010.*
from tttxt010
where tttxt010.ctxt = :txtno
and tttxt010.clan = :clan
|* or any of your language code
and tttxt010._compnr = :comp
order by tttxt010._index1
selectdo
buffer.line = buffer.line & tttxt010.text
endselect


Just keep a check on the tttxt010.text field as its domain is of string 240 if you have long lines of text increase the buffer.line size so that you wont cross the array limits.

NOTE - This is for texts, for the RTF texts you have to refer to the other tools table tttxt015.

you can make it generic into a DLL and call with different parameters like -

long function get.text.lang(clan, txtno, comp, ref text)

Hope it helps you out.

Han Brinkman
21st May 2002, 09:57
Why not assign the number to a text field, without actual storing it (db.write e.g.), and use the text functions after that?

Han

olabas
21st May 2002, 11:06
Hi

Your code works well.

Thank your very much.

olabas
21st May 2002, 11:46
To Han Brinkman

(Why not assign the number to a text field, without actual storing it (db.write e.g.))

That was also one idea I had. But I think that is the "dirty" way.
Also I was afraid of side effects.

Han Brinkman
21st May 2002, 15:27
Ain't reading the txt tables yourself also dirty?

You are assuming something that ain't documented.

In my way you only use a table field as a temp variable, I don't think that dirty.

However it's up to you, you have a working solution and that's what counts.

Kind regards,
Han