Focal Point
[SOLVED] '.' and EVAL

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5621024613

February 02, 2009, 01:59 AM
<Navin>
[SOLVED] '.' and EVAL
Hi All

I am trying to tokenize &Temp using '.'

To say , since that &Temp is not having '.' in it , &Temp should not get tokenized when the following STRTOK is applied.

-SET &Temp = 'ABCD*E *TR &|FGH TR ABOUT TR';
-SET &TL = &Temp.LENGTH;
-SET &REP = '.';

-SET &MODSTR = GETTOK(&Temp,&TL,1,&REP,50, 'A50');
-SET &MODSTR = TRUNCATE(&MODSTR);

-TYPE &Temp;
-TYPE &MODSTR;


o/p

ABCD*E *TR &FGH TR ABOUT TR;
ABCD*E;

It gets corrected when STRTOK is rewritten as

-SET &MODSTR = GETTOK(&Temp,&TL,1,&REP.EVAL,50, 'A50');

I dont understand why , Can anyone help me out ? What is the significance of EVAL here ?

This message has been edited. Last edited by: Kerry,
February 02, 2009, 03:52 AM
GamP
Navin,

Could be a specific thing for the 71 release that you're working with.
I tried your code in 76(2) and there it just gives me the correct output.
Maybe upgrade is in order?


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 02, 2009, 04:22 AM
Tony A
The .EVAL forces an evaluation of the variable string prior to the parsing of the DM statement that contains the variable.

No doubt J.G. will be along any moment with an IB explanation?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
February 02, 2009, 08:46 AM
<Navin>
Also,


-SET &REP = '-';

-IF (&REP EQ '.') THEN REPO ELSE NOREPO;
-REPO
-TYPE WORKS SUCCESSFULLY
-NOREPO

'-'(hiphen) and '+' equates to '.' in the above code. Others doesnot work obviously. Any idea why ?
February 02, 2009, 12:34 PM
j.gross
Dialog Manager attempts to treat comparisons as numeric-to-numeric. The values '.', '-', '+', '0', and ' ' are treated as representations of zero, and are therefore all 'equal'.

(I guess someone once authored validation/classification/parsing code to handle a potential number, and allowed for the digits, signs, decimal points and leading spaces. Once all the individual characters pass that test, evaluation of the "number" begins with zero and swallows the characters one at a time. Nothing happens to change the initial value, so zero it is....)

ASIS(&var) will force &var to be treated as a character string.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
February 10, 2009, 10:15 AM
<Navin>
Thanks Gross
that worked.