Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This is correct ?
Message
De
31/12/2004 19:32:14
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00973168
Message ID:
00973598
Vues:
15
>>Thanks, Sergey,
>>Your example is optimal.
>>
>>I have realized this the past night
>>(strange, but the things that I do not understand in kind I understand them when I sleep);
>>before, I hoped of being able to use NORMALIZE() in order to control the syntax of an expression inserted from a my customer in a field expression;
>>but even if a function existed that check the syntax, to use it is mistaken,
>>TRY/EVAL()/CATCH within a context it is the solution.
>>
>Hi Fabio,
>
>I see where confusion comes from. The NORMALIZE() function wasn't design to validate systax of expression passed but rather to convert already valid expression to what VFP consider 'normalized" form so it can be compared to result returned by such functions as KEY() or FILTER().

Infact!

Look into the NORMALIZE() See Also section:
see you correct reference ?
EVALUATE( ) | ISUPPER( ) | PROPER( ) | UPPER( )

they have not meant in this context.

Correct references are:
FILTER() | KEY() | FOR() | RELATION() < CAN YOU ADD OTHERS ? >


Now i try your example, and on my configuration VFP don't normalize DTOC(fld2,1)
to DTOS(fld2).
CREATE CURSOR test (;
	fld1 C(1), fld2 D, fld3 int)
lcTagKey = [fld1+DTOC(fld2,1)]

INDEX ON &lcTagKey TAG f12

? UPPER(KEY(1)) = UPPER(lcTagKey)  && .T.
? KEY(1) = NORMALIZE(lcTagKey)     && .T.
Therefore for VFP they are not the same thing! Why ?

I return to the original point, now;
if NORMALIZE() return the normalized format of a VFP expression,
why it uses a different parser ? VFP uses two parsers ?

This does not go well.

If I must confront the two things,
I would have to get for to me same errors with same inputs.
CREATE CURSOR test (fld1 C(1), fld2 D, fld3 int)
lcTagKey = [fld1+DTOC(fld2,1)+"""]

? NORMALIZE(lcTagKey)      && no errors
INDEX ON &lcTagKey TAG f12 && error
Therefore we cannot use NORMALIZE() in order to control if an expression syntactically is corrected for being used in KEY(), FILTER()...

Then, for me it is still incorrect.

Or ... i use NORMALIZE() like preventive operation
for having one to remove the dirty parts from one expression.
But also this does not convince me a lot,
because it can remove important parts without signalling this fact.
CREATE CURSOR test (fld1 C(1), fld2 D, fld3 int)
lcTagKey = NORMALIZE([fld1+DTOC(fld2,1)+"""])
INDEX ON &lcTagKey TAG f12 && no errors
Therefore, NORMALIZE() can be used, but only with specified conditions.

Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform