berthe
26th March 2003, 16:32
I want to print a text on a report. To make sure the text is printed on 1 page (not 1 part at the bottom of a page and the next part at the top of the following page), I use the function 'need' in the report script. The considered text is 2 lines.

Use code:

before.orco.54:
before.layout:
l.nr.lines = 0
if (text.present.in.language(tcmcs901.txtg, tcmcs046.lang,
l.nr.lines) = 0) then
lattr.print = false
else
need(l.nr.lines)
endif

The first time I come in 'before.orco.54' everything is fine,
the second time I come in 'before.orco.54', I get the following errors:

4 : process 21 - Fatal error : Function 'need'; Recursion not possible refcount=2.
5 : process 21 - Fatal error : Can not continue in rtdsls4401010000 in DLL: ottstprepdll (need)[bms.receive$]
6 : process 21 - Fatal error : Recursion not yet implemented
7 : process 21 - Fatal error : Can not continue in rtdsls4401010000 in DLL: ottstprepdll (need)[]

Both the first as the second time I come in 'before.orco.54', I'm in the middle of the page...

mark_h
26th March 2003, 16:47
I though something like this had been discussed before - follow this thread (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=607&highlight=text+and+report).

Good Luck!

Mark

berthe
26th March 2003, 17:04
Thanks for the very quick reply!
I tried to change the local variables, but unfortunally I doesn't.

Berthe

berthe
26th March 2003, 17:17
I tried to replace the local variables into external variables, but I still receive the same error messages.

The code I use now is as follow:

l.nr.lines = 0
if (text.present.in.language(tcmcs901.txtg, tcmcs046.lang,
l.nr.lines) = 0) then
lattr.print = false
else
e.nr.lines = l.nr.lines
need(e.nr.lines)
endif

Berthe

mark_h
26th March 2003, 18:00
The one I was pointing to was the post about 7th down by Spartacus. It shows that he programmed a need function using spool.pg.length and the actual line number. I have never used the need function so you may want to try that approach.

Good Luck!

Mark

berthe
26th March 2003, 18:20
Hi,

I tried to replace the function 'need' by the following code:

if ((spool.pg.length - lattr.lineno) < e.nr.lines) then
page()
endif

and this works just fine!

Thanks
Berthe