Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
View Definition problem
Message
From
09/01/2013 13:37:16
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01561890
Message ID:
01561930
Views:
48
>>This applies to any kind of "calculated" fields, also text fields. Today I selected from a table with only two records, using a UDF which created a new string, like newstring = trim(string1) + ' ' + trim(string2). The record I searched for using the appropriate Where filter, came out as c(9) which would have been correct for the first record in the table. However, the record I searched was the second one, and for this record I got truncated data. I don't know if C(9) was chosen by VFP because of the data in the first record, or if it is some default field length. But the result puzzled me, I was not prepared for this behavior with such a small table.
>
>
>Foxpro does grabs the first record of the returned resultset and uses the information to create the cursor, so the first record returned from your trim(string1) + ' ' + trim(string2) expression was C(9), so it was used to create the resulting cursor, this is either documented or very well known behaviour, cannot remember which :)

I know that's the case for returned values, but in the case I tried to explain about, the first record is not returned at all. At least "not by me" since the Where clause only matched the second record. I see your point, and I learned to always use cast whenever I want to retrieve data which involves any kind of "calculation".
Previous
Reply
Map
View

Click here to load this message in the networking platform