Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The number in Replicate creates a problem
Message
From
05/04/2022 19:14:36
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
 
 
To
05/04/2022 15:58:33
Lutz Scheffler (Online)
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
01684050
Message ID:
01684086
Views:
34
>>The problem is the use of ALLTRIM with a field longer then 10 chars in SELECT SQL. Look at message#01684075, I gave all the info were the problem comes from there.

Thanks, Lutz! And your explanation holds up with various other tests- e.g.
SELE ALLTRIM(LEFT(c1,4)) AS c1 FROM mycur INTO CURSOR cmycur
It processes the LEFT to decide field length, but not the ALLTRIM. It's as if the VFP parser is "smart" enough to know that ALLTRIM() can and I'm sure used to deliver undersized resultset fields. So, ignoring alltrim() when calculating selected field lengths makes sense, but a cause for unexpected issues as seen by Dmitry!

FWIW, I'm pretty sure there was a time when you had to PADR() expressions to prevent undersized results, with confirmations as recently as 2003 on internet search- but I can't provoke it now by using SET ENGINEBEHAVIOR 70 etc. Maybe it got fixed in VFP7, leaving dinosaurs like me laboring on with obsolete truths. ;-)

I experimented using varchar; your example now works as expected, yielding a V(10) result field with len(c1)=0 for first row... , but the same issue Dmitry saw with replicate and V(15).
"... They ne'er cared for us
yet: suffer us to famish, and their store-houses
crammed with grain; make edicts for usury, to
support usurers; repeal daily any wholesome act
established against the rich, and provide more
piercing statutes daily, to chain up and restrain
the poor. If the wars eat us not up, they will; and
there's all the love they bear us.
"
-- Shakespeare: Coriolanus, Act 1, scene 1
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform