>>Gregory
>>
>>Thank you for the explanation. I would have been many hours arriving at that conclusion! If at all. The curious thing is that it has been working fine for several months. Maybe by chance the resulting figure format has agreed with the view so far and this has come about on one particular record.
>>
>>Anyway, sorted. And thanks again for your input. Much appreciated.
>>
>>Barry.
>
>Make it a rule to always use CAST for calculated fields. Don't rely on VFP (or any other backend) to make correct assumptions about the final field type.
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.