Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted (edited)

Um, i really couldn't think of a better topic name :).

I need a field where a user can enter either a date or text... but i need to be able to identify through calc if its a date or plain text.

I was thinking of using If IsValid(GetAsDate(field)) but i'm also thinking that i have to use a date field for this and if i use a datefield for this it will give me an error if plain text is input...

Also i'm using a custom dialog here and all three fields are already being used so i cant put any additional indication in (i don't want multiple dialog's).

Thanks for any help or suggestions.

EDIT: I forgot to mention that the "plain text" will have numbers in it aswell though there will be no "/". Thinking along these lines i'm also thinking that GetAsDate(field)<>"?" would work.

~Genx

Edited by Guest
Posted

IsValid(GetAsDate(field))

I can spot a flaw or discrepancy in the reasoning by thinking of the 30th of february, entered in dateformat is alright but the date as such will cause the bleepers to go on.

Also i'm using a custom dialog here and all three fields are already being used so i cant put any additional indication in (i don't want multiple dialog's).

Now, it's not clear to me if validation dialogs is the only issue here, but sometimes can you make use of conditional validations by adding a validation field 1 pix in both dimentions as well as having it's borders in the background colour, with disallowed entry.

To this field add a calculated validation covering all the field in question, and remember to lift the lower left corner checkbox in the calc'def. saying "Validate only if...."

I can only think of few legitimate reasons for landing your self in this limbo...

And what about dates in text fields? There may at times be a reason to put a date in a text field. Though at the moment I can’t think of one, it has been done. A date in a text field can be converted to a real date. However, if that field contains dates such as: May 2003, 1.1.04, 2-2-2002, 3/3/03, 4|4|2005, 2001; you face a genuine brain bender. If users are allowed to place dates in a text field, this is exactly the kind of mess you will get.

...and one of those that might be alright could be structures like this:

http://previews.filemakermagazine.com/videos/513/DataTagging_full.mov

But here is the user promted to cathegorize the type, so you behind the scenes can make a conditional validation.

--sd

Posted

Hmm perhaps, but in my case users are trained to use the solution and would be instructed to insert only standard format dates. As per the 30 of feburary issue, yes, but i may try implementing:

If(Substitute( TextField ; "/" ; "") <> TextField ;

//Assume user is trying to enter date, do an isvalid check and if isn't valid return error to script and prompt user if they were trying to enter date ;

//assume user is trying to enter text )

Posted

You can create a global date field. Then, in your script, as the user has put the data into the dialog, set the global to the value of the field you wish to check. Set error capture on, and evaluate the isvalid you mentioned. If not, the value that was put in, is not a date.

It seems tricky to me nevertheless, because how can you control how users enter a date? Some might be using the correct syntax with the brackets, some might not enter the year with four digits and stuff like that. I am interested to hear why you want to do this anyway!

Posted

Year doesn't need to be included only d/m or dd/m or dd/mm or d/mm, year is assumed to be the current year unless stated otherwise in which case it can be in the format yy.

Doing this for contact reminders in my solution, the issue is i'm really out of fields in the custom dialog and i wan't users to be able to schedule a reminder either on a specific date or use a time period such as 1 day, 2 weeks, 3 months, today etc. These are all recalculated in calc field to work out the date but if the user enters a date i need it to sense that the user has entered a date rather than some other value.

Btw, setting error capture to on never really occured to me but i'm not sure its detailed enough.

~Genx

Posted

And, just as an afterthought: you know what assuming can do, right? It makes an "ass" out of "u" and "me"... ;-) Hope the first syllable is not changed by the automatic code of conduct rules...

Posted

Yes, which is why they get prompted as to whether they were trying to enter a date :).

I must admit i've never heard that one before though lol.

Posted

but in my case users are trained to use the solution

Genx, this is a little naive. Just because they are trained today, doesn't mean they will always follow directions. Users will always find a different way to use the solution than you anticipated. I learned that one the hard way...

Mike

Posted

a) i really don't think it's naieve, its not as if 17/3/06 or 17/3 isn't a standard format in australia.

:P as a second precaution they are shown in the custom dialog the appropriate format

c) third in terms of the textual values they are restricted to only about 15 values that they can enter

~Genx

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