Wrong calculation by Appian?

Certified Senior Developer

Hi together,

I have the following calculation:

ri!timstamp(decimal)="1630391405000"

if(
  isnull(ri!timestamp),
  todatetime(null),
  a!localVariables(
    local!hours: floor(ri!timestamp/1000/60/60),
    local!hoursMilli: local!hours*1000*60*60,
    local!tsMinusHours: ri!timestamp - local!hoursMilli,
    local!minutes: floor(local!tsMinusHours/1000/60),
    local!minutesMilli: local!minutes*1000*60,
    local!tsMinusMinutes: local!tsMinusHours - local!minutesMilli,
    local!tsMinusMinutes
  )
)
result 5000(decimal)

if(
  isnull(ri!timestamp),
  todatetime(null),
  a!localVariables(
    local!hours: floor(ri!timestamp/1000/60/60),
    local!hoursMilli: local!hours*1000*60*60,
    local!tsMinusHours: ri!timestamp - local!hoursMilli,
    local!minutes: floor(local!tsMinusHours/1000/60),
    local!minutesMilli: local!minutes*1000*60,
    local!tsMinusMinutes: local!tsMinusHours - local!minutesMilli,
    local!seconds: todecimal(quotient(local!tsMinusHours, 1000.00)),
    local!seconds
  )
)

result 1805(decimal)  - expected 5


addition: the "todecimal" was already a try to fix it as i could imagine that it was perhaps a format issue.


5000/1000 results into 1805 instead of 5 and i absolutly dont get why it happens.
quotient() gives the same result as I would divide it via "/"
Any ideas?

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data