Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Strange Dialog Manager behaviour
Go
New
Search
Notify
Tools
Reply
  
Strange Dialog Manager behaviour
 Login/Join
 
<Pietro De Santis>
posted
This is weird. I have a snippet of DM code:
-SET &ECHO=ALL;

-SET &VAL1 = '';

-SET &TEST1 =
- IF (&VAL1 EQ '.') THEN 'XXX' ELSE 'YYY';

-SET &TEST2 =
- IF ('&VAL1' EQ '.') THEN 'XXX' ELSE 'YYY';

-SET &TEST3 =
- IF ('&VAL1.EVAL' EQ '.') THEN 'XXX' ELSE 'YYY';

-TYPE TEST1: &TEST1
-TYPE TEST2: &TEST2
-TYPE TEST3: &TEST3
that does not work correctly.

When I set the value of &VAL1 to '.', I would expect the result to be XXX, but it is not for TEST2.

When I set the value of &VAL1 to '', I would expect the result to be YYY, but it is not for TEST1 and TEST3.

When I set the value of &VAL1 to 'a', it works correctly - I get YYY for all three TEST values.

I had to do this to make it work.

-SET &ECHO=ALL;

-SET &VAL0 = '.';
-SET &VAL1 = 'X' || &VAL0 || 'X';

-SET &TEST1 =
- IF (&VAL1 EQ 'X.X') THEN 'XXX' ELSE 'YYY';

-TYPE TEST1: &TEST1
What's happening here?

This message has been edited. Last edited by: <Mabel>,
 
Reply With QuoteReport This Post
Guru
posted Hide Post
Lets see if I can explain this correctly.

To my understanding the reason you are getting incorrect results is because of when the amper variable is being evaluated. By using &VAL1 and '&VAL1.EVAL' they will be replaced with there value before the code runs. '&VAL1' will be replaced with its value after the code runs, this is why it looks right. Since '&VAL1' and '&VAL1.EVAL' are strings not variables by using .EVAL in the string it will cause the variable to replaced with its value before the if statement is processed.

-SET &ECHO=ALL;
-SET &VAL1 = '.';
-SET &TEST1 = IF ('Hi &VAL1' EQ 'Hi .') THEN 'XXX' ELSE 'YYY';
-SET &TEST2 = IF ('Hi &VAL1.EVAL' EQ 'Hi .') THEN 'XXX' ELSE 'YYY';
-TYPE TEST1: &TEST1
-TYPE TEST2: &TEST2

Also if you have a variable that could be '' you may want to use the function ASIS() since '' and 0 will evaluate to the same thing.

-SET &ECHO=ALL;
-SET &VAL1 = '';
-SET &VAL2 = 0;
-SET &TEST1 = IF (ASIS('&VAL1.EVAL') NE 0) THEN 'XXX' ELSE 'YYY';
-SET &TEST2 = IF (ASIS('&VAL2.EVAL') NE 0) THEN 'XXX' ELSE 'YYY';
-SET &TEST3 = IF ('&VAL1.EVAL' NE 0) THEN 'XXX' ELSE 'YYY';
-SET &TEST4 = IF ('&VAL2.EVAL' NE 0) THEN 'XXX' ELSE 'YYY';
-TYPE TEST1: &TEST1
-TYPE TEST2: &TEST2
-TYPE TEST3: &TEST3
-TYPE TEST4: &TEST4
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Reply With QuoteReport This Post
<Pietro De Santis>
posted
Curtis, thanks for your explanation. I was aware of the difference between '&AVR.EVAL, '&VAR' and '&VAR', but this does not explain why, when the amper value being tested is a . (dot), the DM code does not work.

Thanks,

Pietro.
 
Reply With QuoteReport This Post
Expert
posted Hide Post
hmmm what an intersting prob.
The dot operator is a comment signal to scripting languages, so i'm guessing that DM somehow is tripping over that.
The empty is more puzzling:
given &VAL1='';
then &VAL1.EXIST equals 1
and &VAL1.LENGTH also equals 1
both of which are counter-intuitive results ,to me. I'm expecting 0 at least for the second test. Meaning &VAL1=''; is the same as &VAL1=' ';, hmmm.
How about seeing if the hex translation is a hex40, a real blank.
Your work around certainly seems totally reasonable.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Reply With QuoteReport This Post
Platinum Member
posted Hide Post
What is your NODATA setting? I seem to remember that we had some problems with a DM situation with NODATA = . (dot, that is).
 
Posts: 124 | Location: Lebanon, New Hampshire | Registered: April 24, 2003Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Strange Dialog Manager behaviour

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.