Jump to content

This topic is 7058 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi,

I have a field that contains time displayed in 8 digits (01:02:03:04) that represent Hours:Minutes:Seconds:Frames. I currently have to manually enter the colon between each set. I'm hoping that there is a way to have the colons automatically entered so that I could simply type in 01020304 and have it automatically display as 01:02:03:04. However, I still need to be able to paste a time value which already includes the colons. Does anybody know of a way to implement this?

Thanks!

Posted

Try something like a text field with calculated value of:

Let ( x = Filter ( test colon ; "0123456789" );

Left ( x; 2 ) & ":" &

Middle ( x ; 3 ; 2) & ":" &

Middle ( x ; 5 ; 2) & ":" &

Right ( x; 2 )

)

Make sure that the checkbox for 'Do not replace existing value..." is unchecked.

Posted

I like the first option because it allows me to enter only 6 of the 8 digits and it orders them as hh:mm:ss... Also, I like that I can paste a timecode in and it remains formatted correctly as hh:mm:ss:ff. The second option is great because it follows the rules of drop frame time code. However, this option reformats anything input into the field. So if I paste 01:02:02;29 into the field, the result is 02::0:2;;29. How would I go about getting the best of both? Also, is there a way to do this so that if I manually enter the first six digits of the timecode (hhmmss) the result is hh:mm:ss:ff where ff is 00? (The first option duplicates the seconds in the frames.)

Thanks again.

Posted

So if I paste 01:02:02;29 into the field, the result is 02::0:2;;29

Hm... It's so long ago, I don't remember what the requirements were in that thread.

In any case, you can try this (result is Text);)

Let ( [

TC = Right ( "00000000" & Filter ( TimeCodeEntry ; "0123456789" ) ; 8 ) ;

hh = Middle ( TC ; 1 ; 2 ) ;

mm = Middle ( TC ; 3 ; 2 ) ;

ss = Middle ( TC ; 5 ; 2 ) ;

ff = Middle ( TC ; 7 ; 2 ) ;

separator = Case ( Right ( TCFormat ; 1 ) = "d" ; ";" ; ":" ) ;

error =

hh > 23 or mm > 59 or ss > 59

or

ff >= GetAsNumber ( TCFormat )

or

Right ( TCFormat ; 1 ) = "d" and ff < 2 and ss = 0 and Mod ( mm ; 10 )

] ;

Case (

error ; "Invalid Timecode" ;

Time ( hh ; mm ; ss ) & separator & ff

)

)

I am not so sure about 6 digits being interpreted as hh:mm:ss:00 - it goes against the convention of ignoring the hour. But you can try changing the definition of the TC parameter to something like:

TC = Right ( "00000000" & Left ( Filter ( TimeCodeEntry ; "0123456789" ) & "00" ; 8 ) ; 8 )

Posted (edited)

Cool. The newer formula works great - it even solves the drop frame/non drop frame display issue I've been working on. However, it returns h:mm:ss:ff instead of hh:mm:ss:ff when the hh is less than 10. I resolved this by substituting "hh & ":" & mm & ":" & ss" for "Time ( hh ; mm ; ss )". Is there a better way to do this?

Also, there's one part of the error that I can't seem to get to work:

Right (TC Format ; 2) = "df" and f < 2 and s = 0 and Mod (m ; 10)

I believe this should return an error if the TC Format is drop frame and the time code has 00 for ss and 00 for ff on any minute but 10, 20, etc. For example, 01:01:00;00 should return an error while 01:20:00;00 would not return an error. However, it doesn't seem to return the error... Also, is there a way to have it result in rounding up the frames from 00 to 02 instead of the error? So, if 01:01:00;00 is entered in drop frame, how can the result be 01:01:00;02 instead of the error?

Thanks!

Edited by Guest
Posted

The problem is I have shortened my original formula without checking the consequences.. Try it this way:

Let ( [

TC = Right ( "00000000" & Filter ( InPointEntry ; "0123456789" ) ; 8 ) ;

hh = Middle ( TC ; 1 ; 2 ) ;

mm = Middle ( TC ; 3 ; 2 ) ;

ss = Middle ( TC ; 5 ; 2 ) ;

ff = Middle ( TC ; 7 ; 2 ) ;

separator = Case ( Right ( TCformat ; 1 ) = "d" ; ";" ; ":" ) ;

error =

hh > 23 or mm > 59 or ss > 59

or

ff >= GetAsNumber ( TCformat )

or

Right ( TCformat ; 1 ) = "d" and GetAsNumber ( ff ) < 2 and GetAsNumber ( ss ) = 0 and Mod ( mm ; 10 )

] ;

Case (

error ; "Invalid Timecode" ;

hh & ":" & mm & ":" & ss & separator & ff

)

)

To correct invalid entries instead of flagging them, exclude the condition from the error definition and make another Case() statement using the same condition.

This topic is 7058 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.