Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
fixing old code w/ len(tablename.fieldname)
Message
From
08/03/2001 18:50:05
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
fixing old code w/ len(tablename.fieldname)
Miscellaneous
Thread ID:
00483363
Message ID:
00483363
Views:
45
I attempted the following code:

alter table surveyans add column cresponse c (len(responses.cresponse))

responses.cresponse had a null value. The code failed. I guess then, that VFP is evaluating the expression itself, not the length of the field in the table, which makes sense. I never realized this would fail with null values.

First, as a workaround, i positioned the record pointer at eof(), and then evaluated len(). Then I realized that I can just use fsize(). This is fine going forward for new apps.

But Is there any kind of workaround for this to fix existing code that breaks as a result of this problem, short of doing mass replaces/hunts for all occurrences of len() in an existing app ?. I guess someone some kind of trap could be added to the error handler ?

This led me to another question. I have a notion, that may or not be correct, that under Clipper, one could redefine existing built in functions. Can the same be done with Fox. My understanding is that it can't.

I tried:

=len()


function len

wait wind 'new len function'
return .t.

but VFP didn't recognize my new len function.

I wish there was a 'SET USE_YOUR_OWN_UDFS ON' COMMAND !

VFP 7 ?



TIA
Next
Reply
Map
View

Click here to load this message in the networking platform