RE: Difference of two ratio numbers

Hi ,

I need some calculation logic in appain that gives difference of ration numbers example shown below in the screenshot.

Can someone help me to write the logic for this on priority?

Here actual and threshold values are user inputs based on those inputs variance col data to be shown .

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to JS0001

    a!localVariables(
      local!ratio1: "3:4",
      local!ratio2: "5:6",
      local!ratio1Array: split(local!ratio1, ":"),
      local!ratio2Array: split(local!ratio2, ":"),
      local!lcm: lcm(
        local!ratio1Array[2],
        local!ratio2Array[2]
      ),
      local!numerator: (
        local!ratio1Array[1] * (local!lcm / local!ratio1Array[2])
      ) - (
        local!ratio2Array[1] * (local!lcm / local!ratio2Array[2])
      ),
      local!result: if(
        mod(local!numerator, local!lcm) = 0,
        local!numerator / local!lcm,
        concat(local!numerator, "/", local!lcm)
      ),
      local!resultArray: split(local!result,"/"),
      local!lcm2: ((local!ratio1Array[2]*local!resultArray[1])/(local!ratio1Array[1]*a!defaultValue(
        value: index(local!resultArray,2,1),
        default: 1
      ))),
      local!lcm2*100
    )

Children