September 10, 200520 yr my client would like to have a mask for date entry, either 0216 (month, day, current year) or 02sep (day, abrv month name to number) when I just try a simple mask on a date field it fails, so the first question is it possible to mask a date entry. second question if possible here is what I have. /* Let ( [ num = Filter ( Lower(dte) ; "abcdefghijklmonpqrstuvwxyz" ) ; txt = Filter (dte ; "0123456789")] ; Case ( IsValid ( dte ) ; dte ; // Is entry in valid date format? Length ( txt) = 0 ; Date ( Left (dte ; 2) ; Right (dte ; 2) ; promoYr ) ; Length ( txt) > 0 ; Date ( Substitute (Right ( dte ; 3) ; ["jan" ; 1] ; ["feb" ; 2] ; ["mar" ; 3] ; ["apr" ; 4] ; ["may" ; 5] ; ["jun" ; 6] ; ["jul" ; 7] ; ["aug" ; 8] ; ["sep" ; 9] ; ["oct" ; 10] ; ["nov" ; 11] ; ["dec" ; 12]) ; Left (dte; 2) ; promoYr); dte )) */
September 10, 200520 yr In layout mode, select the field, and choose Date... from the Format menu. All the options are there.
September 11, 200520 yr Author thank comment, It is more of a question about creating different options for user entry. The user would like to only type four digits (month and day) or type a day and the abbreviated month. Then the mask would convert it to a propper format for entry.
September 11, 200520 yr Sorry - missed the point about entry. First, if you only enter the day and the month (or vice-versa, depending on your settings), separated by a slash (or your chosen delimiter, depending on your settings again), Filemaker will accept it as a valid entry in the current year. AFAIK, it is not possible to enable entry without a delimiter directly into a date field: date validation precedes auto-entry. You could make the user enter the data into a text field, and make the date field depend on that. But such entry must follow much stricter rules: With a delimiter, 1/11 in a DD/MM/YYYY setting is clearly Nov 1. Without a delimiter, it has to be 0111 in order to be disambiguous. However, if your user insists, you could make the date field auto-enter (replace) something like this: Let ( [ mmdd = Filter ( DateEntry ; "0123456789") ; string = "janfebmaraprmayjunjulaugsepoctnovdec" ; mmm = Filter ( DateEntry ; string ) ; m = Div ( Position ( string ; mmm ; 1 ; 1 ) ; 3 ) + 1 ] ; Case ( Length ( mmm ) = 3 ; Date ( m ; mmdd ; Year ( Get (CurrentDate) ) ) ; Length ( mmdd ) = 4 ; Date ( Left ( mmdd ; 2 ) ; Right ( mmdd ; 2 ) ; Year ( Get (CurrentDate) ) ) ) )
Create an account or sign in to comment