Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

Ok, if I do this calc in a calc field and result text:

Date("NonDateText")

I get a result of "?"

so, is there a way to capture this error and with a case statement offer an alternative answer?

Posted

FileMaker will only accept Dates in Date Fields, and if you want to convert text to a date, then you will need to use one of the Date Functions depending on how the text is.

What does the text look like?

Lee

Posted (edited)

Can you explain where you will be using this, and what for? Without it, the question is too wide (i.e. too many possible answers).

BTW, Date ("string") will always return an error, no matter what the string is.

Edited by Guest
Posted (edited)

Possibly an IsValid ( ) ? It would return 1 (boolean true) if it was a date field but the date was not recognizable by FM, ie, IsValid(textDate)

Yes. We can't know without more information but I got the better of myself ... :

Edited by Guest
Posted

Can you explain where you will be using this, and what for? Without it, the question is too wide (i.e. too many possible answers).

BTW, Date ("string") will always return an error, no matter what the string is.

I know that Date ("string") will always return an error... let's pretend that a user entered "Last Monday" instead of 1/2/2000.... is there and error capture where i can allow errors to result as the text they were entered as?

Posted (edited)

Last Monday can't be entered into a date field. It would help to provide specific, real examples.

Edited by Guest
Posted

A user entered "Last Monday" instead of 1/2/2000 where? Let's NOT pretend, and have a clear picture of the situation instead.

Date ("1/2/2000") will also return an error, so I don't see how that's relevant.

Posted

Calculations don't return error codes, so you're on the wrong path right from the outset. Only script steps return error codes. The "?" is the closest thing you'll get to a calculation returning an error. (In fact that what it's returned for.)

LaRetta's suggestion of using IsValid() is a good one. That's exactly what the function has been created for.

You might have some luck with GetAsDate( Text ) but the success will depend on the OS date format (dd/mm/yyyy or mm/dd/yyyy) and the consistency of the data entry.

Otherwise you're going to have to parse the entered text, try to guess it's meaning and process it accordingly. It's not a trivial job.

Much frustration is caused by original posters trying to "generalise" their questions: subsequent posters spend time and effort answering the question posted only to be told "that's not really the case..."

Posted

Calculations don't return error codes

They can, if you want. For example,

EvaluationError ( Evaluate ( "Date ("1/2/2000")" ) )

will return 1201 ('Too few parameters in the function'). But it requires repeating the entire formula as text, which may not be convenient in most circumstances.

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