Skip to main content
New Idea

Managing Rounding issues in the MDA

Related products:None
  • June 6, 2019
  • 1 reply
  • 40 views

christopher_sanderson
Hello all

Dropping this more as a solution, but would love to see a better productized resolution as well.

I have run into issues where I need non-rounded values returned in my rule results, but there is no way to truncate or force that behavior within any of the data or transformation tasks. Even if you push a value with a decimal into a field with no decimals, it will still round based on normal math rules (4 or less is down, 5 or more is up). Examples of data this affects:

  • Time, especially when thinking about hourly billing (if I needed to convert from seconds to a HH:MM:SS format)
  • Curreny
  • Date differences

However, I have found a way to capture that value within an MDA table, which may result in needing more than one rule to realize the solution, but offers flexibility with data types and results.

You will need:

  • Fields [list]
  • These will come in pairs [list]
  • One for the decimal value
  • One that is a calculated field [list]
  • You will need to do an advanced formula, using the below CASE statement [list]
  • CASE WHEN "FIELDNAME" >0 THEN trunc ("FIELDNAME") ELSE 0 END
[/list][/list][/list]
  • Rules

    • One rule to calculate the decimal value and push it into the MDA table
    • One rule to perform your actions based on the value captured in the calculated field
    [/list]One of the biggest reasons I want to expose this on Community is that there are some very interesting things you can do with Advanced Formulas, especially CASE statements. Would love to see more examples of interesting formulas people have used to solve awesome use cases!

  • 1 reply

    jitin_mehndiratta
    Thanks for sharing this Christopher. Would love to hear more from others as well about the use cases they are solving by using Advanced formulas/case statement within Rules engine.


    Reply


    Cookie policy

    We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

     
    Cookie settings