ciptadi
5th March 2007, 10:01
Dear all,
I have problem to convert text from table(tttxt010). The problem occcur when I want to convert text with multi lines into single line string. For example:
I have a text in table tttxt010 as follows:
Purchase of Drinking water
For March 2007
DOC: WHC009929

How can I convert this text into single line string. I have tried, but the result is It still converted as 3 lines of string.
Actually after I convert this, I will open it via MS Excell, so I hope it can be one row only, not become 3 row.

Any Idea?
Thank you very much.

Ciptadi Nugroho.

bdittmar
5th March 2007, 10:26
Dear all,
I have problem to convert text from table(tttxt010). The problem occcur when I want to convert text with multi lines into single line string. For example:
I have a text in table tttxt010 as follows:
Purchase of Drinking water
For March 2007
DOC: WHC009929

How can I convert this text into single line string. I have tried, but the result is It still converted as 3 lines of string.
Actually after I convert this, I will open it via MS Excell, so I hope it can be one row only, not become 3 row.

Any Idea?
Thank you very much.

Ciptadi Nugroho.

define string item.text.file(500)
#include <bic_text>

Hello,
try the function text.to.buf

function read.itemtext()
{

item.text.file = ""

string itext(200)
string ibuf(80,40)
long i

itext = ""

for i = 1 to
text.to.buf("tiitm001.txta", "language", 1, ibuf)
itext = strip$(itext)&" "&shiftl$(shiftr$((ibuf(1,i)))
endfor

item.text.file = itext
}

The resulting string contains " Purchase of Drinking water For March 2007 DOC: WHC009929" !

Maybe the shiftl$ > shiftr$ on textbuffer variable will do the work ?

Regards

ciptadi
5th March 2007, 12:31
Dear bdittmar,

Thank you very much for your advice, this solve my problem.

Next question is how to discard the string that comes from "tab". We can discard any space by using strip$, shiftc$(), shiftl$(), shiftr$(),etc.
How about to discard tab in a string.

My last example
"Purchase of Drinking water__________"
"For March 2007_____"
"DOC: WHC009929"

it become:

"Purchase of Drinking water__________For March 2007_____DOC: WHC009929"

It's because sometimes our uses without awareness, press tab to their keyboard before they type new line in their text.

More Idea?

Thank you very much for any suggestion.
Ciptadi.

Note: Mark "_" representates the tab

george7a
5th March 2007, 13:06
Hi,

I have done once a function that removes the "tab" from a string. You will have to go through all the chars in the string and check if it equals to "chr$(9)" (It is the ASCII code of the tab) if yes delete it.

If you have problems I can look for the function and post it here...

I hope it helps,

- George

ciptadi
13th March 2007, 03:49
Dear All.

George, your advice is works well. Thank's.

Ciptadi.