bhaswar
12th February 2003, 14:40
Hi ,

I am fairly new to baan programming. In a report i want to print the rounded qty (2.7 = 3). There is a round function in the Manual pages but does not give much help on the syntax. Can someone guide me please? Examples would be great help.

Also is rounding the variable in the program script the best way to do it or can something be done on the report level.

Thanks in advance

Bhaswar

marekm
12th February 2003, 15:22
Hi

There is a stupid but working trick:
x=2.7
y=int(x + 0.5)

Try this.

Marek

evesely
12th February 2003, 16:12
You can round in the program script, report script, report print expression -- wherever your hear desires :)


round(double value, long diga, long mode)


value is obviously the value you want to round.
diga is the number of positions after the decimal point when you are done rounding -- in your example, this is 0.
mode determines whether to (0) truncate (i.e., no rounding, just cut off excess digits), (1) round normally (i.e., if digit after cutoff is >= 5, round up, otherwise round down/truncate), or (2) round up (always).

Examples:

round(2.715, 0, 0) = 2
round(2.715, 0, 1) = 3
round(2.715, 0, 2) = 3

round(2.715, 1, 0) = 2.7
round(2.715, 1, 1) = 2.7
round(2.715, 1, 2) = 2.8

round(2.715, 2, 0) = 2.71
round(2.715, 2, 1) = 2.72
round(2.715, 2, 2) = 2.72


I hope that helps

OmeLuuk
12th February 2003, 16:23
You can also take advantage of the rounding functions in
#include "itccom0007" | round quantities
#include "itccom0001" | domain round

NPRao
12th February 2003, 20:28
Please refer to the other tools function - format.round() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_mathematical_operations_format_round)