Error for Query Builder database function
Hello,
I am calculating using Time Difference (days) how long an Activity has been open or was open before completion. I have nested it inside the Decode function in order to account for the 2 scenarios of Actual Finish being Null or populated with a completion date. The user is unable to accurately sort the result of the Decode because it handles it like a string and does not put them in chronological order. So I have nested the Decode inside the To Number function. This allows the numbers to be sorted properly. The numbers bring back along of decimal places so I wanted to restrict that to 2 decimal places and tried encasing the entire thing inside the Round function. When I add the Decode function inside the To Number function I get the error “Attributes of data type string are not valid for this function”. Does anyone know why that error would be produced? The To Number outside of the Decode functions correctly and sorts correctly as a number. But when I try the entire thing inside the Round is when I get an error.
This works correctly......

When I try to do the Round function as the outer function on all of the above, adding the Decode function below the To Number function is when the error pops up.

Thank you!

