>>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)
? KEY(1) = NORMALIZE(lcTagKey)
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)
INDEX ON &lcTagKey TAG f12
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
Therefore, NORMALIZE() can be used, but only with specified conditions.
Fabio