Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Issue: ALINES(,NULL) return a empty element
Message
De
20/11/2004 11:44:11
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Titre:
Issue: ALINES(,NULL) return a empty element
Divers
Thread ID:
00963208
Message ID:
00963208
Vues:
56
Previous issue Thread #961358

Bug/Issue : 12 of 33

TITLE: Design bug, ALINES() of a NULL string, return 1 and it fills up the array's row with a '' string

VERSION: 09.00.0000.1720 and VFP8SP1

EXPECTED:
ALINES(ax,null) return 0 without execute any operation on ax

OBSERVED:
ALINES(ax,null) return 1, build/dimension ax to 1 and fill it with '' string.
This is a behaviour written on help, but this is a chosen completely mistaken,
why it generates a loss of data information,
and it generates mistaken information from the null one, because it transforms a disowned data in an empty known data;
that it forces to complicate the code uselessly.

REPRO:
x=ltrim(null)
? ALINES(ax,m.x),len(ax[1])
WORKAROUND ( slower down the operation with long strings )
* use
IIF(ISNULL(m.x),0,ALINES(ax,m.x))
Example where this is necessary ( empty elements on a list have information )
FOR k=1 TO ALINES(ay,'4,,5',',') && 3 elements '4','','5'
	? m.k,ay[m.k]
NEXT
FOR k=1 TO ALINES(ay,'',',')	&& 1 element
	* ay[m.k]
NEXT

FOR k=1 TO ALINES(ay,NULL,',')	&& none elements
	* i cannot compute a unknown want 
NEXT
* of course i can workaround this,
* but for do this i have to change the data domain to ',...'
* and skip the first row empty sentinel with FOR k=2 TO ...
* ( but on this case NULL it is not necessary, 
* and I represent null with the '' string )
* then, i have to corrupt the data model in order to avoid the VFP problem
Solution: add a nFlags bit ( 5 ) that fixed this ( return 0 with NULL cExpression )
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform