PRB: FSIZE() Returns Zero If Expression Has Trailing Spaces (311063)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft Visual FoxPro for Windows 7.0

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().

MORE INFORMATION

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 ("labels.Type")
lcField = SUBSTR(test.cField, AT(".", test.cField) + 1)
lcAlias = LEFT(test.cField, AT(".", test.cField) - 1)

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

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbCodeSnippet kbnofix kbprb kbXBase KB311063