i have a field call Starting year he accept only 4 degitels and is numeric only
how i can do this script
The Year() function?
Year( Get(CurrentDate) ) will return 2016.
i went to never enter day and month only year
Are you trying to validate a user entering in a year value? or are you trying to script the entry of a year into a field?
The former, you can use a simple calculation to validate the input:
Length(GetAsNumber(self)) = 4 and self > 1900
That will validate that the value is numeric, four characters, and greater than 1900.
If you want to adjust so it's at least the current year and 4 characters:
Length(GetAsNumber(self)) = 4 and self > Year(Get(CurrentDate))
If you just want to make sure it's equal to the current year:
self = Year(Get(CurrentDate))
To script, use the Year() function to get a year out of some date you specify (or just pass the four digit year), using the Set Field script step.
i have a button inside this button i have a script to validate the fildes
1-the Filde accept only nomber
2-only 4 digits
3-and in the fildes of year start with the current year
And Thank you for helping
The plot thickens.
Not. (At least not for me.)
So you are validating what a user inputs, scripts have nothing to do with this.
You can uncheck the other validation and check "validate by calculation".
Then use the calculation I pointed out before:
If you want to adjust so it's at least the current year and 4 characters:Length(GetAsNumber(self)) = 4 and self > Year(Get(CurrentDate))
Then you can specify a custom message for if that fails that says "Enter a 4-digit year that is at least the current year".
In field options on the validation tab, you can also specify a strict data type of "numeric only" and limit the number of characters to 4.
Then you validation calculation need only be:
self >= year ( Get ( Currentdate ) )
(It looks like Mike left out an = in his example...)
how i can deactivate characters
he pressing on "a" ------> "" (Empty)
he pressing on "1" ------> "1"
If you want results while a user is typing, then you need to use script triggers.
If you just want to strip it after the user has entered, you can use:
Filter( self ; “0123456789” )
As part of an auto-enter calculation.
(thanks for picking up the >= phil )
u canmake this in image
I want script triggers
Here is the documentation for Script Triggers:
Understanding and using Script Triggers | FileMaker
Here is a video about how to use script triggers:
FileMaker Tutorial - Learning Script Triggers - YouTube
Documentation for the filter function:
FileMaker Pro 15 Help
Documentation for the self function:
Video explaining auto-enter fields:
Auto-Enter Options for Fields | FileMaker 14 Training Videos - YouTube
i want to use OnbjectKeyStroke and Filter ( self; "0123456789")
Both the video and documentation I link to provide details on using triggers.
Controlling data entry keystroke by keystroke can rapidly lead to very complex scripts as you'll need to both block out most non-numeric keys, while still enabling those used for editing and positioning the cursor to work. I wouldn't recommend this unless you are ready to take on a pretty major scripting effort here.
Retrieving data ...