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.
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.
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.
[Fix for expression giving 0% or missing decimal part](https://community.appsheet.com/t/fix-for-expression-giving-0-or-missing-decimal-part/15061) Tips & Tricks ?
Trying to divide two numbers to get a percentage but always getting 0? Trying to divide two numbers but losing the numbers after the decimal point? TRY THIS Convert one or both of the values in your division expression to a Decimal value, either by: (1) wrapping the value in the expression with the DECIMAL() function; (2) multiplying the value in the expression by 1.0; or (3) changing the column’s type to Decimal if suitable to the app. FOR EXAMPLE If computing a percentage from two Number co…