Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Transform(phone,
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01019262
Message ID:
01019274
Views:
25
It's 3:46am currently and I'm actually still working from the day before (something I'm known for doing way too often).

The problem you were running into is that VFP needs to know what the field lengths are before it can return the result set. In the case of a variable length field, such as you had with the transform, VFP takes it's best guess by looking at the first record and seeing how long that field would be to hold the data. Then it creates that field as that length and if any of the later records have data that is longer, it truncates it. By using the PADR() function we were able to, in a sense, tell VFP that our field would be 11 characters long.

>Yes, that works, but I do wonder why?
>
>If I'm not much mistaken it's 5 in the morning your place. Whatever are you doing in front of a computer at this hour?
>
>Anyway, thank's!
>
>BR
>
>Peter
>
>>Try this:
>>
>>Select Padr(Transform(Mytable.Phone,"@R 99 99 99 99"), 11, " ") As Phone from Mytable
>>
>>
>>>
>>>? Transform(38109945,"@R 99 99 99 99")
>>>
>>>
>>>Returns 38 10 99 45, as expected.
>>>
>>>But:
>>>
>>>
>>>Select Transform(Mytable.Phone,"@R 99 99 99 99") As Phone from Mytable
>>>
>>>
>>>Returns 38 10, which is certainly not what I expected.
>>>
>>>I assume it's a valid expression, since VFP does not complain, but I'm clearly stretching it's capabilities.
>>>
>>>TIA
Previous
Reply
Map
View

Click here to load this message in the networking platform