Effective December 3, NetApp adopts Microsoft’s Business-to-Customer (B2C) identity management to simplify and provide secure access to NetApp resources.
For accounts that did not pre-register (prior to Dec 3), access to your NetApp data may take up to 1 hour as your legacy NSS ID is synchronized to the new B2C identity.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

WFA Function to roundup

rogerhinson

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

 

 

 

1 ACCEPTED SOLUTION

geringer

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

View solution in original post

2 REPLIES 2

geringer

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

View solution in original post

rogerhinson

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)
}

 

 

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public