RobertB
12th August 2002, 12:15
This is one for the printing gurus out there...

I have written several reports (Baan5.0c) where it would be nice to have the occasional field printed in some other font (italic, bold, reversed, whatever) based on some condition.

So, for instance, there might be twelve fields across the page within a detail section each representing monthly earnings and, if the value is, say, negative, the field should be printed bold.

I'm aware of the Baan Windows Printing functions cf$ (to set font), pf$ (set printer font), pp$ (to send an escape sequence to the printer), but I'm thinking I can only use these with a spool.pr.line of my own making, and not with that which is created "on-the-fly" by the Report generator as it is actually printing.

If I do create my own spool.pr.line variable and send it to the spooler with spool.line(), the pagination of the report goes "out of synch".

So, is it possible somehow to trap the automatically-generated report line and insert the required control-codes or BWP functions or is there a much easier solution I've overlooked?

Puzzled,
RobertB

mark_h
12th August 2002, 16:36
I am not a printing guru, but could you put a couple of fields in the detail layout. One field before the detail record and one field after the detail record. Then in the report script you would initialize the first field to set your special print conditions, the second field to turn them off. You could set your print condition for each of these fields based on some number being negative.

Or you could use detail layouts to do the samething. Like detail.1 could have the commands to do bold and italics. The detail.2 would be you record. Then detail.3 could have the commands to set everything back to normal. In the report script you could do a check in detail.1 and use lattr.print=false to skip printing it. The same with detail.3.

Just some thoughts.

Mark

RobertB
13th August 2002, 14:44
Hi Mark,

I'm not quite sure what you mean, but I'm after something like this :

Monthly earnings:
Jan 2002 Feb 2002 Mar 2002 Apr 2002 May 2002 .....
1200.00 600.00 2500.00 -200.00 500.00
-2125.00 3000.00 450.00 795.00 4500.00
where the negative values should appear enhanced (bold red in this example).

Anyway, I've just had the idea of doing the headers as single-column, but the numerical fields themselves as a set of 12 multi-column detail sections - I don't know if this is possible on the same page, but I'll give it a go. In this way, I could have just the two details, one normal, the other bold, and switch between them as per condition.

Well, it pays the rent :p ...
Bob

mark_h
13th August 2002, 15:55
I see what you are looking for now. Just wondering if instead of doing different detail layouts you could make your print fields strings. Then in the script you could check the number:


somestr = str$(earnings)
if earnings < 0 then
somestr = formatstr + somestr
endif


Need less to say you would init you formatstr to what ever characters you wanted. Your report layout would have somestr as the field to be printed. A lot more coding, but fewer layouts to maintain if they you ever want to change the format.

Mark

RobertB
13th August 2002, 17:52
Much the better idea! - you mean like this:
detail.1:
before.field:
prn.long.field = ""
fld.tab = 16
for ii = 1 to 12
tab.pos = tab.pos + fld.tab
fld.fmt.1 = ((double.cmp(xxttt001.month(ii), 0.0, 0.0001) = -1) ? cf$(1) : "")
fld.fmt.2 = ((double.cmp(xxttt001.month(ii), 0.0, 0.0001) = -1) ? cf$(0) : "")
this.field = edit$(xxttt001.month(ii), "-----ZVD99")
prn.long.field = prn.long.field & tab$(tab.pos) & fld.fmt.1 & this.field & fld.fmt.2
endfor
BUT, and here I have to hang my head in shame, why don't I do this in each separate field ANYWAY? - here I am running around like a chicken with no head, and the answer is staring me in the face:
detail.1:
before.field:
for ii = 1 to 12
mth(ii) = xxttt001.month(ii)
if (double.cmp(mth(ii), 0.0, 0.0001) = -1) then
mth(ii) = cf$(1) & mth(ii) & cf$(0) | Toggle bold...
endif
endfor
Hoo boy, it's back to school for me, I think :confused: .....