Number Rounding Using Nintex Workflow (Part 2)

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.

Resolution:
In order to remedy this issue, I had to modify the workflow to include these steps:

  1. 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.
  2. 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.
  3. Create a new text workflow variable to store the rounded number with commas (i.e. wfvConvertNumber).
  4. Configure the “Build string” action to use the fn-Round Inline Function and store the result in wfvConvertNumber. Go to Step 5 next.
  5. 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
  6. Use the “Set variable” action to set wfvRoundedNumberText = wfvConvertNumber.
  7. 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:
Nintex Workfow Number Rounding

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: