# VC value changed after saving

Hi you all!

I am having some trouble with a virtual column on a shift tracker app.

I have:
[Start] and [Finish] columns as DateTime
[Deductible Break] as Duration

[Units] as Enum (“per day” or “per hour”)

VC [Payable] with the formula:
[Finish]-[Start]-[Deductable Break]

VC [Pay] as Decimal with the formula:
IF(HOUR([Payable])+(MINUTE([Payable])/60)<8,8,HOUR([Payable])+(MINUTE([Payable])/60))
(minimum 8hrs paid)

[Rate] as Price

VC [Subtotal] as Price with the formula:
IF([Units]=per day,[Rate],[Rate]*[Pay])

!!!ISSUE!!!

If the [Units] is set to “per day” and the [Rate] will be 102.50 then the [Subtotal] will stay be and stay as 102.50.

If the [Units] is set to “per hour” and the result will be 102.50, this will be shown in the form and after saving but after sync, it will round it up to 100.

Can’t find where the rounding up is happening.

Any clues?

Thanks!

In the form:

Detail:

After sync:

It most likely has to do with decimal vs number… Maybe take that whole expression, and wrap it with a *1.0 see if that does it, then hone in on exactly where to make that tweak.

3 Likes

Thank you!
Just tried it but it still does the same thing

IF(HOUR([Payable])+(MINUTE([Payable])/60)<8.00,8.00,(HOUR([Payable])) * 1.00+(MINUTE([Payable])/60.00))

Edit: Minor modification to the expression

4 Likes

ok, it works! thank you!

WHY?
What’s *1.00 doing and what’s /60.00 doing?

I believe @Steve may give correct explanation. I will try.

However as per my understanding , the earlier expression was giving a rounded number value , because even though the column type is DECIMAL , all expression calculations were based on NUMBER types. I believewith reference to the help document below, the earlier expression was equivalent of first example in the help document , that is DECIMAL(10 / 3) = (3.0)

I may be incorrect in my above explanation.

I suggested revised expression by previous experience of working with decimal calculations and of course some testing in similar test scenario.

5 Likes

@Suvrutt_Gurjar Thanks for getting in there!

1 Like