cancel
Showing results for
Did you mean:
Workflow Hero

## After a calculation I need to display one decimal only, how I can do it?

After a calculation I need to display one decimal only, how I can do it?

Labels: (1)

10 Replies
Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

Alex,

In the Properties of the Calculated Value you do have the option there to set the number of decimal places. This will limit the number of decimal places used in the calculation though - not just what is displayed. So it rounds the generated value to the decimal places stipulated.

If this is not what you want, you could have this calculated value generate the full number with whatever decimals are allowed and utilise a second Calculated value that would take the first value as an input and then set the required one decimal place in this one You would then use this one for your display, while hiding the original value.

Cheers,

Mark

Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

Is your calculation in a form with a calculated value or in workflow with a Math operation action ?

Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

Caroline, I'm using Math operation action.

Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

Mark,

I don't have that properties of the calculated value (Math operation), only let me set the results in a variable.

Let me explain what I'm doing: I have multiple questions (Collected from InfoaPath form in to SharePoint) and each question has an score, If they answer the question Correctly I give the Numerator and Denominator variable a value and at the end I calculate the score by "Math Operation" of the 2 variables (Numerator devided Deniminator) and after that I multiply the new result by 100 and now I just need the score with just one decimal.

I hope you understand what I'm doing and trying to do.

Thank you for help out.

Alex

Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

I forgot to mention is not NINTEX forms the issue, is on NINTEX workflows.

Thank you.

Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

Sorry Alex,

My assumption was that this was inside a Nintex Form. Are you storing the end result in a List Column? If so it would be a matter of defining the column to have one decimal place.

If this is not an option, as crazy as it may seem, there is no easy way to do this within the Workflow mechanism.

One way would be to add an Execute SQL control and utilise SQL functionality with a query similar to the below:

select convert(decimal(5,1),round({WorkflowVariable:varTestNumber},1))

Simply using a Round call will round the number, but leave zeroes in the place of the other trailing decimals. The Convert will take care of this.

Cheers,

Mark

Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

Another way to get a number with only one decimal in Nintex Workflow is to :

• use a Math operation action to multiply the number by 10
• use a Set variable action to round the previous number to the nearest integer :
• the variable to set has to be of type single line of text
• the value to set is : fn-Round(yourNumberVariable)
• use a Math operation action to divide the previous number (stored in a single line of text variable) by 10

Hope this helps

Workflow Hero

## Re: After a calculation I need to display one decimal only, how I can do it?

This is the solution in my case. It Works.

Thank you soo much Caroline.

Workflow Hero