5 Replies Latest reply on Nov 30, 2016 9:33 AM by dsimonson

    Data entry into a time field - the colon problem!

    dsimonson

      I am working on a method to avoid users having to enter colons into their time fields.  They hate it!  They want to enter only numbers.  My solution requires a lot of time entries (medication times, blood pressure times, etc.), and is to run in FM Go. 

       

      There was an excellent discussion of this issue back in 2013

      Re: Data entry filter for time field? Also delete seconds value?

       

      I am planning on using a script like this as a variation of the calculations provided:

      ==

      IF (Parameters::Time = "")

      (Show a dialog and return to the field)

      End IF

       

      Insert Calculated Result [Select: Let(

      @T = RIght( "0000" & Filter( Parameters::Time ; "0123456789") ; 4) ;

      Left( @T ; 2 ) & ":" & Right( @T ; 2 ) ) ]

      ==

       

      My problem is, I would like to use this in a script trigger set off by "on object validate" for any of the many time fields (not just Parameters::Time) on my layouts.  But I don't want to have to change the calculation for every field, so I thought about using the "self" reference.  Doesn't work. 

       

      How can I create a script that can be called by any field without having to specify the field each time?