Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vartype and type not interchangeable on field in table
Message
 
 
To
01/03/2011 19:17:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01502308
Message ID:
01502313
Views:
46
The TYPE() function evaluates expression passed to it not the type of the field. AFIELDS() + ASCAN() will do the trick

>I need to preprocess a table or cursor and replace all nulls with zeros for numeric fields and spaces for character, empty dates, etc.
>
>I have mytable open, it has a column - rate
>
>I put numeric data into it
>?vartype(mytable.rate) && shows N
>?type("mytable.rate") && shows N
>
>I put a null into it the data
>
>?vartype(mytable.rate) && shows X
>?type("mytable.rate") && shows N
>
>So it looks like vartype is evaluating the data type of the data in the field, whereas type is evaluating the data type of the field? In this case, what I need is the data type of the field. I guess I can rely on type for this?
>
>Ideally though I'd like to have a function like get_field_datatype(). I could create one by creating a temp table with copy structure extended and querying that table for the field's data type. I don't see though that a native function exists to do this?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform