Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How determine entered value type
Message
 
 
To
22/06/2000 19:24:02
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00383408
Message ID:
00383538
Views:
16
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 && User's input
local lcRetType
* Firstly check, if it's a logical 
if len(lcValue)=3 and inlist(lower(lcValue),'.t.','.f.')
  lcRetType='L'
endif
* Check if it's a date
if empty(lcRetType) and (len(lcValue)=10 or len(lcValue)=12) && Could be date
   if substr(lcValue,3,1)='/' and substr(lcValue,6,1)='/' && (10/12/90)
    * check the rest
   endif
endif
** etc., etc.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform