Hi Cindy and everyone,
On the way home I was thinking about this problem. I have two ideas:
1) Make a best guess of the passed value type, e.g write a rouitine like this:
function CheckType
lparameter lcValue
local lcRetType
if len(lcValue)=3 and inlist(lower(lcValue),'.t.','.f.')
lcRetType='L'
endif
if empty(lcRetType) and (len(lcValue)=10 or len(lcValue)=12)
if substr(lcValue,3,1)='/' and substr(lcValue,6,1)='/'
endif
endif
2) The second idea is not put textbox at all on the form, instead create several classes (or borrow it from here Files section) like txtNumbers, txtDate, txtDateTime, etc. and then add object in run-time depending on which field type was selected from the combobox to replace.
What do you think?
>Nadya,
>
>Here's one more idea: ISDIGIT(). You would need to parse the string one character at a time. Also, if you encountered a "/" or "-" you could check that the rest of the format was an appropriate date.
>
>
>>Hi everyone,
>>
>>We have a Global Editor form, which allows to globally modify field's contents. The form itself is quite simple, it has combobox with fields and textbox to enter a value to replace with. Now, suppose I choose Numeric field and type 11 in this textbox. How can I check, that this entered value is Numeric and replace my field with this?
>>Same question for date, datetime, and logical fields as well...
>>
>>Thanks in advance.
If it's not broken, fix it until it is.
My Blog