Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Nintex Community
- :
- Forums
- :
- Nintex for SharePoint
- :
- Nintex Forms - math function

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi,

I have a case where I need to divide two numbers and round up to nearest integer and store the result in a calculated field. This is commonly known as a "ceiling" function.

Example | Division | Round | Floor | Ceiling | |
---|---|---|---|---|---|

100 / 10 | 10 | 10 | 10 | 10 | |

18 / 10 | 1.8 | 2 | 1 | 2 | |

12 / 10 | 1.2 | 1 | 1 | 2 | |

3 / 10 | 0.3 | 0 | 0 | 1 |

I can only seem to find a "round" function. Neither the "Floor" og the "Ceiling" is available as far as I can see.

Any ideas on how to overcome this?

Regards

Leif

Solved! Go to Solution.

12 Replies

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

Hi

I have done the following before:

Take the value you have from division above and do the following:

1. calculate round

2. if round = division ---> set ceiling and floor = division

3. if round > division ---> set ceiling = round, floor = round - 1

4. if round < division ---> set ceiling = round + 1, floor = round

does that make sense?

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

from calculated value control you can directly call javscript function, so something like this might help

Highlighted
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Also, there's the % operator which gives you the remainder of a division. So 18%10 will return 8. Using the If() you could come up with the calculated value formulas that you're looking for.

For example the below seems to do the trick for me (using result examples from Wikipedia):

- Floor:
If(equals((Val01%Val02),0),round(Val01/Val02,0),(Val01-(Val01%Val02))/Val02) - If(lessThan((Val01/Val02),0),1,0)

- Ceiling:
If(equals((Val01%Val02),0),Val01/Val02,((Val01-(Val01%Val02))/Val02)+1) - If(lessThan((Val01/Val02),0),1,0)

The subtraction part is to compensate for negative numbers.

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

Hi Cassy,

It definately makes sense - thanks for your input. I will have to wrap it in some nested "if/then" structure inside my formula however, since my problem relates to Forms instead of Workflow.

Regards

Leif

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

Hi Fernando,

I am not sure if this can somehow be utilized in a form. Is it not only within a workflow that this is working?

Regards

Leif

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

Hi Marian,

I hadn't thought of this. This is definately worth trying as long as Mobile Forms are not required - which it fortunately isn't in my case

Regards

Leif

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

Hi Jean-Pierre,

That's pretty awesome - simple but efficient. And it will work in Mobile Forms as well

Regards

Leif

Highlighted
##

Jump to solution
Reply

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Re: Nintex Forms - math function

Yeah sorry about that I went off on one without reading the title of the question properly! Glad you got a resolution!