ianmuir Posted January 28, 2010 Posted January 28, 2010 Hi, I have 2 fields Time_from and Time_to. Say I enter 14:00 in Time_from, what I need is a script that enters the time in the next field(Time_to) plus 1 hour so it would be 15:00 Thanks
LaRetta Posted January 28, 2010 Posted January 28, 2010 No script needed ...only an auto-enter calculation on the Time_to field. Time_from + 3600 and back at the auto-enter tab, uncheck 'do not replace existing value'. :smile2:
ianmuir Posted January 28, 2010 Author Posted January 28, 2010 Thanks, that works but when it inserts the time in the second field it is like 17:00:00 and what I need is 17:00 (no seconds) Changing the time format on the field to hh:mm does not do anything. Any ideas?
LaRetta Posted January 28, 2010 Posted January 28, 2010 It doesn't matter which portions of time reside in a field any more than it does with numbers not having a trailing zero for cents. Those types of issues are handled from the layout level. In layout mode, select the field and Format > time and specify hhmm and 24-hour. :wink2:
ianmuir Posted January 28, 2010 Author Posted January 28, 2010 Yes, I have done that and it still puts in the seconds!
LaRetta Posted January 28, 2010 Posted January 28, 2010 (edited) I may be misunderstanding what you want then. Please check the attachment. The first set shows without layout-level time format as I described. The second set shows it with the formatting. UPDATE: I may not be clear enough, my apology ... What if your start time has seconds? Do you want the time truncated to only hours and minutes? Even if you use a calculation such as: Hour ( TimeStart ) & ":" & Minute ( TimeStart ), the result in the time field (unformatted) will have seconds. And yes, it is inconsistent (something I worked on 6 months back) but I do not know how to make it only put hh:mm in a time field at the data layer. time.zip Edited January 28, 2010 by Guest Added update
ianmuir Posted January 28, 2010 Author Posted January 28, 2010 Hi, my fields are set the same as your example. when the calculation works it adds the +3600 it inserts the seconds. Ian
LaRetta Posted January 28, 2010 Posted January 28, 2010 I don't know what to say; it works in my file but not yours? You will need to zip and attach your file or at least show me your field types, the data in the fields and screen shots of how you have the time formatted at the layout level. If it is working properly in my file but not yours, then something is different and I believe it can only be in those places that I've indicated. :idunno:
ianmuir Posted January 28, 2010 Author Posted January 28, 2010 The field types are the same as yours. You can insert the time manually without the seconds it is only when the calculation inserts the time +3600 that it does it. Thanks though...
LaRetta Posted January 28, 2010 Posted January 28, 2010 (edited) it is only when the calculation inserts the time +3600 that it does it. Correct. If you manually type: 11 - it will insert the data of 11 11:14 - it will insert the data of 11:14 11:14:22 - it will insert the data of 11:14:22 ... and you can format that field to display any way you wish, even as 11:14. But when a TIME field is set via calculation, or script (no matter the calculation used) then it will include the seconds, even if there aren't any. Only through layout can you omit the seconds from display. This drove me nuts last year trying work with ESS data which was inconsistent and those times were required in a relationship (don't ask) and the ESS side was consistent in always showing seconds but FM wasn't. I meant to file a bug report back then but got side-tracked. I removed a paragraph when I suggested changing the field to text. If you do that and use a calc such as Hour ( TimeStart ) + 1 & ":" & Minute ( TimeStart ) then you risk breaking your time because, if TimeStart is 24:14, your result will be 25:14. There are other problems as well, such as user typing 11:30 PM (which is legal time). The text calc wouldn't convert it. Yes, you can create convoluted calculation to address the issues (I had to) but I wouldn't recommend it. Overall, change it from display level (format level time) Edited January 28, 2010 by Guest Added paragraph then removed it again.
Recommended Posts
This topic is 5413 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now