fmartinezber
3rd June 2003, 22:38
How can I align total fields with multiline fields in a form?
Thanks.
lbencic
4th June 2003, 01:15
In Baan V, You can set the variable fattr.total.line = true in your before program section, and use the total line provided by Baan with the display.total.fields() call.
You can read more about that method in the Baan help for the display.total.fields() function.
fmartinezber
4th June 2003, 13:20
It's running.
Thanks a lots
renzosing
7th October 2004, 15:31
I'm trying to using the total line option. The way it is coded now, the total line will contain the value of the last total. I also have played around with it and had it code where I would get to total, but it kept a running total and I want it to list the different amounts and then display the total at the bottom. Sample script is below.
before.program:
fattr.total.line = true
field.print.amount:
before.display:
select tdsls401.oamt:print.total,
tdsls401.ldam:print.discnt
from tdsls401
where tdsls401.orno = :tdsls401.orno
and tdsls401.sqnb = 0
and tdsls401.item = :tdsls401.item
selectdo
print.amount = print.amount +
(print.total - (print.discnt(1) +
print.discnt(2) +
print.discnt(3) +
print.discnt(4) +
print.discnt(5) ))
display.total.fields("print.amount",print.amount)
endselect
lbencic
7th October 2004, 17:11
I think part of the problem is that you are filling 'print.amount' with the totals every row. You want to fill print.amount with only the values of that row. You want to fill a total variable separate with the total for all rows, then assign the total value to the print.amount total field using the display.total.fields command:
field.print.amount:
before.display:
hold.total = 0 |*new
select tdsls401.oamt:print.total,
tdsls401.ldam:print.discnt,
tdsls401.pono:print.pono |*new
from tdsls401
where tdsls401.orno = :tdsls401.orno
and tdsls401.sqnb = 0
and tdsls401.item = :tdsls401.item
selectdo
hold.total = hold.total + |*fill hold.total instead of print.amount
(print.total - (print.discnt(1) +
print.discnt(2) +
print.discnt(3) +
print.discnt(4) +
print.discnt(5) ))
endif
if tdsls401.pono = print.pono then
|* only if you have the same position, fill your print.amount for the row
print.amount = (print.total - (print.discnt(1) +
print.discnt(2) +
print.discnt(3) +
print.discnt(4) +
print.discnt(5) ))
endif
|display.total.fields("print.amount",print.amount)
endselect
display.total.fields("print.amount",hold.total) |* display this only when done
Give it a shot, I did not test. Let us know how it goes.
lbencic
7th October 2004, 17:21
Also, if it does work as planned, that will only get the totals for 1 order. If your session has more than one order then this will not represent the whole selection.
renzosing
7th October 2004, 17:41
It is still giving me the last total for that order, not the overall total. I went in debug mode and I see where print.amount and hold.total has the same value in display.total.fields("print.amount",hold.total)
renzosing
7th October 2004, 21:32
Has anyone used this function?
lbencic
7th October 2004, 22:16
I did the sample during training, years ago now though, it worked, and I have seen it in a few standard programs.
If you have the code, check out the session whinh2545m000, I know it works. The differences I have seen are that they are trying to total up table fields, where you are both calculating the field and totaling the calculated field. Don't see how that would matter, but Baan and table fields - ya never know. They put the calls in a different section and use the 'on.main.table' function to call it with.
renzosing
7th October 2004, 22:35
Thanks, I'm looking a that code now!
renzosing
7th October 2004, 23:44
It worked. Thanks!