ruchi.verma
17th October 2008, 10:34
Is it possible to put a dynamic column in a report layout in BAAN 4.

The requirement is that this column should get printed for only some active parameters and if tomorrow the parametes becomes inactive for all teh records present in that table ... the column should not get printed.

i need an urgent solution.

george7a
17th October 2008, 10:47
When you say the column should not be printed, can it be empty?

if yes, you need to set a Boolean variable in the "print condition" of that field. Check the attachment.

- George

Hitesh Shah
17th October 2008, 16:31
I believe by dynamic you mean data driven. e.g. if there are 5 customers then 5 columns and if there are 10 , then there are 10 columns .

This is possible in baan only with complex programming only using arrays and spool.* functions .

Relatively easier way and which user likes is to give the report to the user in Excel pivot table where user can play with data the way he/she wants .

ruchi.verma
20th October 2008, 15:20
thanks for your inputs Hitesh...

yes you got my requirement correctly..
can you please throw some light on the usage of these spool functions and provide wit a code as an example for the same.

as the report is an xcel report so wat ever you said about giving the report to the user in Excel pivot table where user can play with data the way he/she wants, will not help in my case.

Hitesh Shah
20th October 2008, 15:37
Normally users like to play around with results and that's where Excel / pivot comes in handy . Nevertheless that's ur and ur user's choice .

Also beware of spooling limit of 260 characters in a line. This can limit the larger output . In those case u may just output it to a file.

Using spool functions there are 2 main challenges .
1. To know the number of dynamic columns in advance before starting printing. In this aspect http://www.baanboard.com/baanboard/showthread.php?t=28569 can help u very much.

2. Print the output in the format u desire . Spool functions let u do free form printing assigning meaningful values to spool.pr.line and then spooling the same to device. Following code is incomplete and just a sample of a very large program. This along with example in help, are sufficient to guide u.


spool.pr.line = " " & dtdsc & " :- " & sprintf$("%D(%d-%h-%Y)",date.num())
varlen = (spool.pg.width - len(strip$(spool.pr.line)) -
len(strip$(spool.report)) - len(pgdsc & " :- " & str$(pgno)))/2
spool.pr.line(len(strip$(spool.report))+ varlen) =
spool.report
varlen = len(pgdsc & " :- " & str$(pgno))
spool.pr.line(spool.pg.width-varlen+1) = pgdsc & " :- " & str$(pgno)
spool.line()
| 2nd header line
linectr = linectr + 1
spool.pr.line = " " & attr.company$
varlen = len( cmpdsc & " :- " & str$(get.compnr()))
spool.pr.line(spool.pg.width-varlen+1) = cmpdsc & " :- " & str$(get.compnr())
spool.line()
|3rd line
linectr = linectr + 1
spool.pr.line = " Analysis :- " & str$(rsrl) & " / " & enum.descr$("tubase",basd)
varlen = len("History No :- " & str$(anas))
spool.pr.line(spool.pg.width-varlen+1) = "History No :- " & str$(anas)
spool.line()

linectr = linectr + 1
spool.pr.line = string.set$(chr$(136),spool.pg.width)
pad.pipes(1)
spool.line()
linectr = linectr + 1
ctr = 0
for i = acoln + 1 to arecs
if assvt(i) = ltoe(2) then
if ctr = 0 then
spool.pr.line(1) = strip$(addec(1,i))
else
spool.pr.line(pipe.pos(ctr)+1) = strip$(addec(1,i))
endif
ctr = ctr + 1
| spool.pr.line = spool.pr.line & strip$(shiftl$(addec(1,i))) &
| tab$(pipe.pos(ctr))
endif
endfor