In my previous post titled “Number Rounding Using Nintex Workflow (Part 1)“, I discussed how to round a number using Nintex Workflow.
Well, it turns out that this approach only works for numbers less than 1,000. When you run the previous workflow I mentioned on a number greater than or equal to 1,000, you get the following error message in the “Convert value” step:
Error parsing value. Value ‘fn-Round(12,345.6789)’ is not compatible with the selected output variable type Number (double).
The issue seems to revolve around the commas in the number.
In order to remedy this issue, I had to modify the workflow to include these steps:
- Add a “Set a condition” action to check if the number is greater than or equal to 1,000.
- If the number is less than 1,000, you can go to Step 2 below.
- If the number is greater than or equal to 1,000, then follow Steps 3-6 below.
- Configure the “Build string” action to use the fn-Round Inline Function and store the result in a text workflow variable (i.e. wfvRoundedNumberText). Go to Step 7 next.
- Create a new text workflow variable to store the rounded number with commas (i.e. wfvConvertNumber).
- Configure the “Build string” action to use the fn-Round Inline Function and store the result in wfvConvertNumber. Go to Step 5 next.
- Use a “Regular expression” action to remove the commas in the text workflow variable from Step 2. Configure the action with these settings (then go to Step 6):
- Pattern = ,
- Operation = “Replace text”
- Leave “Replacement text” empty
- Input text = wfvConvertNumber
- Store result in = wfvConvertNumber
- Use the “Set variable” action to set wfvRoundedNumberText = wfvConvertNumber.
- Configure a “Convert value” action to convert the wfvRoundedNumberText variable back to a number store in the Number workflow variable.
You can then use the Number workflow variable in the remainder of your workflow.
Here’s what the workflow should look like: