Re: Field value from a calculated value control not saved

Jump to solution
 what do the Display and Edit settings mean?

'Control mode' setting means that you can overrule control's behaviour in different form modes (new, edit, display)

if you set control's 'Control mode' to AUTO, it will inherit the mode from form - ie. if form is in new or edit mode then control is in edit mode as well (so one can change its value). if form is in display mode, control is in display mode either (so it's just read only - one can see the value but can not change it)

if you set control's 'Control mode' to DISPLAY it breaks behavior inheritance from form mode and always render the control in DISPLAY mode, even on form in new or edit mode.

if you set control's 'Control mode' to EDIT it breaks behavior inheritance from form mode as well, but in this case control always work in edit mode. so one can change its value even on form on display mode. (note however that form in display mode do not persist any values to the list item. so value of control in EDIT mode on form in DISPLAY mode is only valid throughout the form session but never saved)




Would they affect whether the value is calculated? 

no this setting do not affect calculated control value recalculation.

but there are other settings that does, see "​Recalculate formula on XXXX mode" ones




I want to show the calculated value but not allow the user to edit it, except indirectly through changing the end date.

you need not bother with this one for calculated value controls. they are by design not editable, regardless of form mode or control mode setting.




but when i put a Single Line Text box on the form where the variables StartDate EndDate are, the number just remains at zero. 

check carefully definition of DateDiffDays() function. it requires Date datetype inputs passed in.

so either your StartDate and EndDate have to be date picker controls, or you have to convert string inputs to dates (see formatDate() function), or make them Date-s any other way.




A second question is, if the calculation yields a number which is not an integer what happens to the calculation - does it round the number

calculated value control has its quirks, but in general it shows a value how returned by formula. so if formula returns 1.518 it will show 1.518. you have little control over this by setting calculated value control data type (but really just little - I rarely set it to anything else but string)

note however the function definition "Returns the number of whole days between date1 and date2".

plus what's not mentioned in documentation, it always return difference as absolute value (positive number)



hope it make it clearer 🙂 




btw, @johnfriday13,  plaease start new questions for new problems. do not hijack other threads, especially closed ones. it's hard then to follow what problem is discussed.



0 Kudos