Jump to content

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

Recommended Posts

Posted

To facilitate the speedy entry of a date field I have defined a text field (service_date_text) that uses the "Auto Enter a Calculated Value" and unchecked the "do not replace the existing value if any" with the following calculations.

Case (

PatternCount ( service_date_enter; "/") = 0 and Length ( service_date_text ) < 3; GetAsDate ( Month ( Get ( CurrentDate ) ) & "/" & service_date_text & "/" & Year ( Get ( CurrentDate ) ) );

PatternCount ( service_date_text; "/") = 1 and Length ( service_date_text ) > 2 and Length ( service_date_text ) < 5; service_date_text & "/" & Year ( Get ( CurrentDate ) );

PatternCount ( service_date_text; "/") = 0 and Length ( service_date_text ) = 6; GetAsDate ( Replace ( Replace ( service_date_text; 3; 0; "/" ); 6; 0; "/" ) )

)

The above enables the operator to type in just the day of the month and FM will fill in the current month and year. Or the operator can type in the month and day separated by a "/" and FM will fill in the current year. Or the operator can type in a date as "mmddyy" and FM will parse it out to a date with slashes. The auto enter feature works fine and I get a date every time. What's strange is the following... I defined a calculation field with a date result that uses the text field in its calculation... service_date_cal = GetAsDate ( service_date_text ). The calculation field returns a valid date only when you type in "m/d" into the text field even though in every instance the text field auto enters a properly formatted date when the enter is "mmddyy"or "dd". What is happening? I'm beginning to not like FM7.

Posted

why is service_date_text using service_date_enter for its calculation, is it a typo? I used your case statement replacing service_date_enter with service_date_text, both service_date_cal and service_date_text display properly.

This topic is 7236 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.