On change - Filter / Sum Float Values w/Default of Empty

0
Hey Forum, I've created a time capture module within our app, where each day of the week has its own attribute (float). Because the user typically must create several timesheets each period, he needs to be able to tab from input field to input field quickly. When there is a default value for a float attribute and you wish to tab between input fields (after inputting a value that is different from the default) the cursor will not automatically select the default value (e.g. 0) - the user must click and select each default value manually. This is a bit annoying when you must do this dozens of times each biweekly period. The issue arises when I set the default value to empty for float: I've been unable to create the proper if / then statements within the change activity to perform the calculations necessary to calc the weekly total after execution of the Och MF (which is executed upon clicking / tabbing out of each input field). I believe that what I need is a way to separate the attributes that have empty values vs. those that do not, and then sum only those values that are not empty. Any ideas? Thanks!
asked
1 answers
0

Here's something from my own timesheets application:

(if $TimesheetDetail/SundayHours != empty then $TimesheetDetail/SundayHours else 0) + 
(if $TimesheetDetail/MondayHours != empty then $TimesheetDetail/MondayHours else 0) + 
(if $TimesheetDetail/TuesdayHours != empty then $TimesheetDetail/TuesdayHours else 0) + 
(if $TimesheetDetail/WednesdayHours != empty then $TimesheetDetail/WednesdayHours else 0) + 
(if $TimesheetDetail/ThursdayHours != empty then $TimesheetDetail/ThursdayHours else 0) + 
(if $TimesheetDetail/FridayHours != empty then $TimesheetDetail/FridayHours else 0) + 
(if $TimesheetDetail/SaturdayHours != empty then $TimesheetDetail/SaturdayHours else 0)

One further suggestion - you might consider using decimal attributes instead of floats, as floats are being deprecated. Using decimals will make your upgrade path simpler.

answered