JariV Posted December 15, 2006 Posted December 15, 2006 Hi, I've been trying to to solve a small but annoying little issue. I have a number of time fields, to which a time is copied from another time field in an another table. In the originating field the time is input as hh:mm (Leave data formatted as entered). When this data is copied with Set Field-script step to another time field (Format as hh:mm), it is, as expected, displayed as hh:mm. But when the user wants to modify the value in that field, it is suddenly displayed as hh:mm:ss. If you manually remove the seconds, they will not appear again if the value is modified again. Any ideas how to get rid of the seconds in the target field would be greatly appreciated. Jari V.
Lee Smith Posted December 15, 2006 Posted December 15, 2006 (edited) Not sure I'm really understanding you. If you only want the format to show hours and minutes, then select the field in Layout Mode, and change if from As entered, to the format you want for the Time. Lee Edited December 15, 2006 by Guest spelling error
JariV Posted December 15, 2006 Author Posted December 15, 2006 Thanks Lee, The field is already formatted as hh:mm and time is shown as hh:mm when the field is not selected. The problem is only when you place the cursor into the field to edit the value, at that point the seconds also appear. I hope this clarifies the question. Jari V
mr_vodka Posted December 15, 2006 Posted December 15, 2006 The time field type, natively has the time formatted as hh:mm:ss. You can have it display as hh:mm but the data itself will still be hh:mm:ss. If you change the field type to a text, you can display it as hh:mm but then it wont be a time field. A better way maybe to use a calc field with text result to simply display it as hh:mm.
Raybaudi Posted December 15, 2006 Posted December 15, 2006 ... or ( you can do this manually or with a script ): 1) place the cursor inside the time field 2) From ( Menu ) Record > Substitute with calc: LeftWords( yourTimeField ; 2 )
JariV Posted December 15, 2006 Author Posted December 15, 2006 Since the time field is used in calculations, changing the field format as text is not practical. If you edit the data manually, and remove the seconds, it will stay that way (and calculate correctly), even if you exit the field and come to edit it again. Could this type of manipulation be done somehow when copying the data from the other time field? Jari V
JariV Posted December 16, 2006 Author Posted December 16, 2006 Thanks raybaudi, I couldn't make it work. I was playing a bit more with text functions and used "Insert Calculated Result" instead of "Set Field". Now the copy script looks like this: Insert Calculated Result [select; MainTable::Time1; GetAsText(RelatedTable::Time1)] This script seems to copy the time without seconds (even when edited). Jari V
Raybaudi Posted December 16, 2006 Posted December 16, 2006 Yes... and even more secure: Insert Calculated Result [select; MainTable::Time1; LeftWords(RelatedTable::T ime1 ; 2)] BTW: You can use the previous idea to change the just taken values
JariV Posted December 16, 2006 Author Posted December 16, 2006 Yes...even better, thanks again. Jari V
Recommended Posts
This topic is 6614 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