Welcome to Ask Ozar.net !
Welcome to Ask Ozar.net, where you can ask questions and receive answers from other members of the community.
+2 votes

 

Does anyone know how to implement the FLOOR() OR CEILING() mathematical function in BAL ?
 
I'm trying to implement
 
 
set 'Z' to 0.00;
 
set 'the desired value' to (FLOOR ('Z' - 25 / 5)+1 )*100 ;
 
or
 
 
set 'the desired value' to CEIL('Z' - 25 / 5)+1);
 
 
Thanks,
 
-GO 
in BRMS by (330 points)
recategorized by

1 Answer

0 votes

I solved this by writing the following methods in the source code of the XOM object:

private BigDecimal amount;

public BigDecimal getAmount() {
     return amount;
}

public BigDecimal getCeilBasedCalc(int z, int x, int y, BigDecimal n) {
    
return ( new BigDecimal((z-x) / y ).multiply(n) ).setScale(0, RoundingMode.CEILING);
}

public void calculateBasedOnCeil(int z, int x, int y, BigDecimal n) {
    
this.amount = ( new BigDecimal((z-x) / y ).multiply(n) ).setScale(0, RoundingMode.CEILING);
}

And then verbalized the above in the BOM.

by (330 points)
...