Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Problems with Dialog Manager if statment

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Problems with Dialog Manager if statment
 Login/Join
 
Member
posted
Hello,

I found a very strange behavior in the Dialog Manager. I’m trying to test whether the content of a variable is empty or not. The variable is supplied from a launch page. For this I’m using the following statement:

-IF &VAR1.EXISTS THEN GOTO STEP01 ELSE GOTO DONE
-STEP01
-IF ‘&VAR1.EVAL’ NE ‘’ THEN GOTO STEP02 ELSE GOTO DONE
-STEP02
WHERE TEST EQ VAR1;
-DONE
So if the variable &VAR1 contains ‘000000’ as the content, I would assume that the result would be:
-IF 1 THEN GOTO STEP01 ELSE GOTO DONE
-STEP01
-IF ‘00000’ NE ’ THEN GOTO STEP02 ELSE GOTO DONE
-STEP02
WHERE TEST EQ VAR1;
-DONE

Instead the result is:
-IF 1 THEN GOTO STEP01 ELSE GOTO DONE
-STEP01
-IF ‘00000’ NE ‘ THEN GOTO STEP01 ELSE GOTO DONE
-DONE

How can this happen? Does anybody have a solution for my problem?

Thank you
 
Posts: 5 | Registered: April 26, 2006Report This Post
Expert
posted Hide Post
Olaf,

You need to teminate your DM IF statement with a semi-colon and I would remove the EVAL -

-IF &VAR1.EXISTS THEN GOTO STEP01 ELSE GOTO DONE;
-STEP01
-IF '&VAR1' NE '' THEN GOTO STEP02 ELSE GOTO DONE;
-STEP02
WHERE TEST EQ VAR1;
-DONE


However, I would prefer to use -

-IF NOT(&VAR1.EXISTS) THEN GOTO DONE;
-STEP01
-IF '&VAR1' EQ '' THEN GOTO DONE;
-STEP02
WHERE TEST EQ VAR1;
-DONE


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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Hello Tony,

thanks for your comment. The actual if statements are terminated with a semincolon. I tried your code and the result was the same. It looks likes this:
-IF NOT(1) THEN GOTO DONE;
-STEP01
-IF '000000' EQ '' THEN GOTO DONE;
-DONE

How comes that for the comparation both values are equal?

Olaf

quote:
Originally posted by Tony A:
Olaf,

You need to teminate your DM IF statement with a semi-colon and I would remove the EVAL -

-IF &VAR1.EXISTS THEN GOTO STEP01 ELSE GOTO DONE;
-STEP01
-IF '&VAR1' NE '' THEN GOTO STEP02 ELSE GOTO DONE;
-STEP02
WHERE TEST EQ VAR1;
-DONE


However, I would prefer to use -

-IF NOT(&VAR1.EXISTS) THEN GOTO DONE;
-STEP01
-IF '&VAR1' EQ '' THEN GOTO DONE;
-STEP02
WHERE TEST EQ VAR1;
-DONE


T
 
Posts: 5 | Registered: April 26, 2006Report This Post
Expert
posted Hide Post
Hi Olaf,

I have just run the second version and recieved the following output -
-DEFAULT &VAR1 = 000000
-IF NOT(1) THEN GOTO DONE;
-STEP01
-IF '000000' EQ '' THEN GOTO DONE;
-STEP02
-*WHERE TEST EQ VAR1;
-DONE


I commented out the WHERE statement because I was only using the DM function.

What platform and release are you using? This was tested with WF 5.3.2 on Windows 2003 servers using Dev Studio on XP.

I get exactly the same result on rel 7.1.3.

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Gold member
posted Hide Post
Olaf

Try this code:

-DEFAULT &VAR1=;
-RUN
-STEP01
-IF '&VAR1.EVAL' EQ ' ' THEN GOTO DONE;
-STEP02
WHERE TEST EQ VAR1;
-DONE
-EXIT

John K
 
Posts: 62 | Location: New York City | Registered: December 29, 2004Report This Post
Member
posted Hide Post
Hello Tony,

we are using Solaris 8 and WebFocus 5.3.2. Might the OS cause the problem?

Thank you for your help.

Olaf
 
Posts: 5 | Registered: April 26, 2006Report This Post
Expert
posted Hide Post

-SET &ECHO = ALL ;
TABLE FILE CAR
PRINT CAR COUNTRY SEATS
-IF NOT(&VAR1.EXISTS) THEN GOTO DONE;
-STEP01
-IF  &VAR1  EQ ' ' THEN GOTO DONE;
-STEP02
WHERE SEATS GT &VAR1 
-DONE
END
-RUN
 

in your screening condition, you need to make VAR1 the ampver var &VAR1
and..
if it is a literal, not a value, you'll need to enclose it in quotes, otherwise IF COUNTRY EQ FRANCE will bomb, it'll look for a field named FRANCE.
and ... sometimes i have found that EQ '' must be replaced with EQ ' ' (put a space in)
the .LENGTH operator on an &var shows a minimum of 1, and never 0. go figure. something about just addressing it makes it exist...dunno...i think someone else explained it to me once.

This message has been edited. Last edited by: susannah,




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Master
posted Hide Post
OlafMeyer

I'm assuming you want '000000' to not be treated as '' here is a way. Also CHECK out the usage of setting a variable to a value of FOC_NONE

-DEFAULT &VAR1 = '';
-IF 'X&VAR1.EVAL' NE 'X' THEN GOTO :SKIPSET;
-SET &VAR1 = 'FOC_NONE';
-:SKIPSET

TABLE FILE CAR
PRINT CAR COUNTRY SEATS
WHERE COUNTRY EQ '&VAR1';
END


In the above code if I default the variable var1 to blank I get all rows. If I default it to 'ENGLAND' I only get ENGLAND. If I default it to '000000' I get no data.

FOC_NONE tell the WebFOCUS parser the throw away the statement.

Hope this Helps




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by susannah:
if it is a literal, not a value, you'll need to enclose it in quotes, otherwise IF COUNTRY EQ FRANCE will bomb, it'll look for a field named FRANCE.


The right-hand side of the condition in IF is always taken to be a literal value.

But the quotes are harmless, and will save you if the supplied value has an imbedded space.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
oh yeah, thats probably for a WHERE statement.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Thank you for comments.

It seams that there is a problem in Solaris with the comparison of zeros with an empty string or a string with a blank. This might only happen with Solaris. I hope in newer version this bug will be fixed.
 
Posts: 5 | Registered: April 26, 2006Report This Post
Guru
posted Hide Post
Do not forget the ASIS function for discriminating between 0 and blank in DM.
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Problems with Dialog Manager if statment

Copyright © 1996-2020 Information Builders