Subscribe
Accepted Solution

WFA Function to roundup

Hey all,

 

Hopefully this is quick for someone..  I'm just trying to create a function to roundup a value to the nearest integer.  I'm using WFA v2.2.  I've created this:

 

def roundup (num)
{
Math.ceil(num);
}

 

My problem is that it returns a decimal value and OnTap needs an integer value to increase the size of a volume.  Example, if I enter 12, I get 12.0.  If I enter 12.5, I get 13.0

 

I've tried using ((int) Math.ceil(num)); to return an integer, but I get an error that it's an Illegal expression.

 

Thanks,

Roger

 

 

 

Re: WFA Function to roundup

Roger,

     Instead of Math.Ciel(num)    try Integer.ValueOf(num).  If you look at the "actualVolumeSize" function, it appears that "return (int)(Math.Ciel(num))" may also work, or just "(int)(num)" if you really just need the integer component and are not that concerned about rounding up.

 

 

Mike

Re: WFA Function to roundup

Thanks Mike,

 

Just putting the int on the return worked.  I ended up with this.

 

def roundup (num)
{
answer= Math.ceil(num);
return (int)(answer)
}