Rounding Up or Down

Home Forum Formula and Condition Editor Rounding Up or Down

Tagged: 

This topic contains 3 replies, has 0 voices, and was last updated by  blacklr 6 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1220

    blacklr
    Participant

    Is there a way to use the ‘Round’ formula function to round numbers up or down to the nearest 0.5 or whole number? Or any other uncomplicated way to do this?

    #6257

    Use a Set Field or Copy Field and set the value of a Numeric Input field. Change the properties of the Numeric Input field to have only 1 (or no) decimal.

    Workflow software, Process software, Procedure software

    #6260

    blacklr
    Participant

    Doing it this way round the figure to any decimal point but not to the nearest half or whole number. I would like the form to show 0.5, 0 or 1 for example, not 0.2 or 0.3 or 0.8 etc. Is there any way to achieve this?

    #6261

    Here is an example of how to round up. In other words 1.4 will become 1.5 and 1.6 will become 2.0, etc…

    You need two hidden helper fields. I called them “Location of .” and “value after .” When the numeric input field changes data create a behavior. Start with a Set Field. Set “location of .” with an Index Of function (Text = numeric input, Search for the “.”). Next use another Set Field. Set “value after .” with a Sub Text 1 function (Text = numeric input, start index = “location of .” field and end index = 99). Next use a Simple Branch with the condition (“value after .” is less than or equal .5)

    If TRUE use a Set Field to set the value of the numeric input using a Sub Text 1 function (Start index =-1 and end index = value of “location of .”) Then use another Set Field to set the value of the numeric input to numeric input + .5

    If FALSE use a Set Field to set the value of the numeric input using a Sub Text 1 function (Start index =-1 and end index = value of “location of .”) Then use another Set Field to set the value of the numeric input to numeric input + 1

    Workflow software, Process software, Procedure software

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.