fom_ln
23rd November 2023, 15:18
Hello, i have a problem.

With the code below i print twice per row the array, instead of printing it only once at the end of the report in the detail 171.

I used as input field the array flat_string with depth 10, and used in the layout fields the field flat_string(1,i) to dinamically use it.

Can you help me? Thanks!

This is the code of my array:

declaration:

long array.max, posi

extern long i

long max_length, iter_length, flat_length

string flat_string(2000)

extern boolean print.switch


detail.11:

before.layout:

array.max = 10

max_length = 132

posi = 1

if lattr.language$ = "6" then

flat_string = "Something."

else

flat_string = "Something else"

endif



for i = 1 to array.max

iter_length = max_length

flat_length = len(trim$(flat_string))

while posi + iter_length <= flat_length and

flat_string(posi + iter_length - 1;1) <> " " and

iter_length > 0

iter_length = iter_length - 1

endwhile

print.switch = true

test_string(1, i) = flat_string(posi; iter_length)

r.171.s.detail()

posi = posi + iter_length

print.switch = false

if posi > flat_length then

break

endif

endfor

lattr.print = false

mark_h
23rd November 2023, 18:44
Is it printing "something else" twice? That while statement seems to stop at the space in "something else" . I would debug it at looking at the while statement. Not sure why you are skipping the space.

fom_ln
24th November 2023, 09:49
Hello Mark,
thanks for your quick response. While debugging the array is iterating correctly in the while statement. The while statement is needed to calculate the position from which restart from the string and to return only entire words and it works already fine with big strings.
Do you have any other idea? I think the problem is with the sending the array to the layout.

mark_h
24th November 2023, 16:02
If I it makes it thru the while statement okay. What happens with the call to r.171.s.detail() and when it returns? I think now maybe you call r.171.s.detail() it prints, then maybe it goes thru the layout 11, 12, etc and hits 171 again and then prints it again.