Automatically entering time after selecting field
I’m using Filemaker Pro 12 on Windows 7.
I have two fields with current time and a third one which calculates the time difference between the two fields.
I want to have the current time entered into a field after I’m selecting it. For that I’m using a script trigger with “On Object enter” with “Get (Current time)”. Now I wondered if there is maybe an easier way to accomplish it but I think with auto-enter it doesn’t work since the time is created when you create a new record?
Auto-enter calculation of the third field: Field2 – Field1, with “do not replaces existing value of field” uncheck. I have to uncheck it, since Field 1 is always entered first and therefore at the time of calculation in Field2 there is no time entered yet and the calculation gives me a minus value. Is there a better formula for calculating it, so I don’t have to uncheck this option? Since I would like that you can't accidentally overwrite the calculated result.
The other thing is that I want to prevent that users change the time again by accidentally clicking on the field. I know the option to uncheck “allow user to override during data entry”. The problem then is that this only works if I have the script trigger changed to “On Object modify”. But I’m reluctant to use this script trigger since for new users it’s easier to just click into the field to get the current time then to remember that you have to enter something into the field for the script to get triggered.
Maybe I could lock the field with user’s privilege, so they are allowed to enter new records but not modify it? But still there is the danger that if you have these privileges you accidentally change the time. I would prefer a solution where I intentionally have to unlock the field to change anything.
Thanks a lot for any help. :)