itpanarub
21st November 2018, 11:57
Hello guys,

can we put break line on field when display to report and how?
for example:
i have item description : VISCOSITY STANDARD SILICON OIL 100 CPS 96.7 cP (mPa*s), BROOKFIELD @ 600 ML

then i want to put break line after every 40 character like bellow:
VISCOSITY STANDARD SILICON OIL 100 CPS
96.7 cP (mPa*s), BROOKFIELD @ 600 ML

i don't want split the description to be 2 field, but just 1 field to display on report. but when we print the report, the description will be like that.

bhushanchanda
22nd November 2018, 09:15
Hi,


You can do it in a report script.


1. Check the size of the string
2. If its greater that 40 characters, run a for loop for scanning the string and storing it in a new string. And after every 40th character of the original string, add a new line character which is chr$(10) / chr$(13) to the new string.
3. Use the new string on your report layout.


I hope you can write the above logic in your code.

itpanarub
23rd November 2018, 08:43
Hi Bhushan,

Thanks a lot for your suggest.
i have do this on my report script.
if i print to message window, my script is working like below.
VISCOSITY STANDARD SILICON OIL 100 CPS
96.7 cP (mPa*s), BROOKFIELD @ 600 ML

but when i display to report, my script not working like below
VISCOSITY STANDARD SILICON OIL 100 CPS

function GetItemDesc()
{
select tcibd001.*
from tcibd001
where tcibd001.item = {:tdpur201.item}
selectdo
LongItemDesc = tcibd001.cdf_note
nomor = len(trim$(LongItemDesc))

message(LongItemDesc)

if nomor > 40 then

teksWrep()
endif

if nomor < 41 then
LongItemDesc = tcibd001.cdf_note
endif
endselect

}


function teksWrep()
{
string item1(30), item2(30), item3(30), itemitem(80)

LongItemDesc = tcibd001.cdf_note
itemitem = trim$(LongItemDesc)



item1 = itemitem(1;40)
item2 = itemitem(41;80)
LongItemDesc = item1 &chr$(10)& "" &chr$(13)& item2


message(itemitem)
message(item1)
message(item2)
message(LongItemDesc)


}

on my report.
i use this config:
domain tcmcs.s100m for field LongItemDesc (its same on report)
tab display, on domain area i'm thick "link with domain"
tab condition and font, i'm not do anything.