Grace Cheong
7th July 2011, 06:12
Hi all,

I have a long string data(string) and need to convert it to text type (long) and display to report, but it doesn't work.

I need my report output auto display into multil lines from a string consists of long value: Eg: (1111111112222222222333333333344444444445555555555...)
1111111111
2222222222
3333333333
4444444444
5555555555
...

My coding is:

#include <bic_text>
extern domain tcmcs.str256 Str256
String buffer(10,20)
extern domain tctxtn StrLines
extern domain tctxtn multiline

function DisplayText()
{
Str256 = "11111111112222222222333333333344444444445555555555...."
StrLines = lval(Str100) |-- convert to long type
multiline = text.to.buf(StrLines, language$, 10, buffer)
rprt_send()
}


I place the "multiline" to report, it doesn't display data. Is there anything wrong to my coding?


--- Grace ---

mark_h
7th July 2011, 15:37
I think I see what you want, but this will not work. When you use lval on the str100 it is setting text number equal to the value of that 1111112222...etc. Then you say text.to.buff - this would convert the text represented by lval(str100) into the 2 dimension string called buffer.

There are two ways that I can think of the would move string variable str256 into buffer that is printable in lines like you mentioned. The first requires you to write a routine to parse through str256 setting the individual numbers. Of course this assumes a logical break at length or something like that which can be programmed. The second method is to use something like string.scan. So for example on passing pipe delimited files I read in buff and separate them like this scan.ret=string.scan(buff,"%s|%s", field1, field2). This takes buff and separates it into individual fields.

Grace Cheong
8th July 2011, 12:19
Hi,

Thanks your respone, I will try on it.

-- Grace --