Microsoft KB Archive/311063

= PRB: FSIZE Returns Zero If Expression Has Trailing Spaces =

Article ID: 311063

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft Visual FoxPro 7.0 Professional Edition

-



This article was previously published under Q311063



SYMPTOMS
If you pass a field name that has trailing spaces to the FSIZE function, it will not find the name and will return 0.



CAUSE
FSIZE performs an exactly-equal test when searching for a matching field name.



RESOLUTION
Use the ALLTRIM function to strip out trailing spaces in the expression that you pass to FSIZE.



Steps to Reproduce Behavior
Run the following code to see the behavior. Uncomment the last line for the workaround. CREATE CURSOR test (cField C(30)) INSERT INTO test VALUES (&quot;labels.Type&quot;) lcField = SUBSTR(test.cField, AT(&quot;.&quot;, test.cField) + 1) lcAlias = LEFT(test.cField, AT(&quot;.&quot;, test.cField) - 1)

USE HOME + &quot;labels&quot; IN 0 ? FSIZE(lcField, lcAlias) && 0
 * !* ? FSIZE(ALLTRIM(lcField), lcAlias) && 12

Keywords: kbnofix kbxbase kbcodesnippet kbprb KB311063

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.