Remco_Smeets
22nd June 2015, 16:04
A new blog entry has been added:
Problem defining upper and bottom spool margin in LN
Hello all,
I want to write an session that decides for all reports how long the first page may be, and how long the other pages may be.
I want to do this in a seperate session so it can be applied to all reports instead of having to modify all the reports.
I started with:
function extern check.page.start()
{
if lattr.pageno = 1 then
if lattr.lineno < 20 then
lattr.print = false
else
endif
else
if lattr.lineno < 5 then
else
lattr.print = false
endif
endif
}
function extern check.page.end()
{
if lattr.pageno = 1 then
if lattr.lineno < 35 then
else
lattr.break = true
endif
else
if lattr.lineno < 55 then
else
lattr.break = true
endif
endif
}
however i need to have these functions in a spool.open function.
This is where i got a bit stuck. Since i need to stay in the same report (namewise) that i started so i can modify it later on with pdftk.
The lattr.lineno should later be parameterised, hence i put it in an external function.
bhushanchanda
22nd June 2015, 18:43
Hi,
Please create threads in related forums.
Moved this to Tool Development. I guess, you need to pass the values to the functions and then return the values.
Based on the return values, you can do lattr.print or lattr.break things which will be applicable on the called report.
Something like this -
function extern domain tcbool check.page.start(domain tcmcs.long pgno,domain tcmcs.long lnno)
{
if pgno = 1 then
if lnno < 20 then
return(false)
else
endif
else
if lnno < 5 then
else
return(false)
endif
endif
return(true)
}
Remco_Smeets
23rd June 2015, 13:19
Hello bhushanchanda,
Thank you, i rewrote the function, do not have a main function for it, but it will look something like:
function extern tcxls.dll901.check.postion(domain tcmcs.str14 output.device, domain tclong pageno, domain tcmcs.str999 vorlage)
{
check.page.start(pageno, vorlage)
check.page.end(spool.device, pageno, vorlage)
}
function check.page.end(domain tcmcs.str14 output.device, domain tclong pageno)
{
lattr.textlines.max = get.max.page(output.device, pageno)
}
function long get.max.page(domain tcmcs.str14 output.device, domain tclong pageno)
{
select ttaad300.pgln
from ttaad300
where ttaad300._index1 = {: output.device}
selectdo
select tcxls901.pgln
from tcxls901
where tcxls901.dsca = {:vorlage}
selectdo
select tcxls901.pgln
from tcxls901
where tcxls901.pgno = {: pageno}
selectdo
return(tcxls901.pgln)
selectempty
select tcxls901.pgln
from tcxls901
where tcxls901.dsca = vorlage
order by tcxls901.pgst desc
as set with 1 rows
selectdo
if tcxls901.pgln > ttaad300.pgln then
return(ttaad300.pgln)
else
return(tcxls901.pgln)
endif
endselect
endselect
selectempty
return(ttaad300.pgln)
endselect
endselect
{
function long get.page.start(domain tclong pageno)
{
select tcxls901.pgst
from tcxls901
where tcxls901.dsca = {:vorlage}
selectdo
select tcxls901.pgst
from tcxls901
where tcxls901.pgno = {: pageno}
selectdo
return(tcxls901.pgst)
selectempty
select tcxls901.pgst
from tcxls901
where tcxls901.dsca = {:vorlage}
order by tcxls901.pgst desc
as set with 1 rows
selectdo
return (tcxls901.pgst)
endselect
endselect
selectempty
message ("Keine Vorlage einstellungen vorhanden")
return(1)
endselect
}
For some reason it won't keep my tabs after adding the colour it seems.
The problem i'm facing now however is that i want this function to be implemented easy in easy report without having to put it in every "before.layout". Do you have an idea how to solve that easiest?
mark_h
23rd June 2015, 15:17
If your going to add color then surround it with the code tags. Edit you post to see what I did to make it more readable. If you don't use color you could just use code=baan inside the [] then end it with /code. Just a helpful hint for using the board. Sorry can't help with your problem, but it sounds like you want every report to run this and I just do not know how to do that.
Remco_Smeets
23rd June 2015, 16:11
Hello Mark,
Yes it would be for every report with the least amount of efford.
So preferably only 1 function somewhere at the start.
Kind regards, Remco