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     [SOLVED] If statement with an in condition

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] If statement with an in condition
 Login/Join
 
Gold member
posted
Can you use the IN condition with an if statement?

 -SET &FOUND_VALUE = IF &VALUE IN ('01a','01b') THEN 1 ELSE 0;
 


Thanks,

Daniel

This message has been edited. Last edited by: <Kathryn Henning>,


In Focus since 2012
WebFOCUS 8.0.07
Windows, All Outputs
 
Posts: 59 | Registered: November 15, 2012Report This Post
Virtuoso
posted Hide Post
I don't think so.

You can however do this:
-SET &FOUND_VALUE = IF &VALUE EQ '01a' OR '01b' THEN 1 ELSE 0;


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Gold member
posted Hide Post
I don't think the if or statement will help me. I have a variable that is equal to '01a' and I need to see if it is in a string that is equal to '01a OR 01b OR 02'.

Daniel


In Focus since 2012
WebFOCUS 8.0.07
Windows, All Outputs
 
Posts: 59 | Registered: November 15, 2012Report This Post
Gold member
posted Hide Post
'01a OR 01b OR 02' is dynamic and will change it is not a set variable.


In Focus since 2012
WebFOCUS 8.0.07
Windows, All Outputs
 
Posts: 59 | Registered: November 15, 2012Report This Post
Expert
posted Hide Post
quote:
I have a variable that is equal to '01a' and I need to see if it is in a string that is equal to '01a OR 01b OR 02'.

If that is your question, then that is def NOT what your code is asking.
Reread your code carefully.
and use .QUOTEDSTRING b/c you're just freaking me out w/o it.




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
Gold member
posted Hide Post
Sorry for freaking you out. What does .QUOTEDSTRING do? I know its a newbie question but I am new to webfocus.


In Focus since 2012
WebFOCUS 8.0.07
Windows, All Outputs
 
Posts: 59 | Registered: November 15, 2012Report This Post
Gold member
posted Hide Post
quote:
.QUOTEDSTRING
worked thank you so much.


In Focus since 2012
WebFOCUS 8.0.07
Windows, All Outputs
 
Posts: 59 | Registered: November 15, 2012Report This Post
Expert
posted Hide Post
.QUOTEDSTRING does just what it sounds like
it puts a temporary set of quotes around the string, doesn't change the string, just for purposes of the command being executed.

it tells the command (among other things) that this is a parameter we're testing, not a name of some variable.
really critical in a drilldown, eg.
its just good practice




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
Virtuoso
posted Hide Post
Try this:
-SET &FOUND_VALUE = &MyLittleList CONTAINS '01a';


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
I think a small warning about .QUOTEDSTRING is in order here; don't just blindly apply that everywhere.

For starters, if you use that in a variable substitution in a FOCUS WHERE-clause (ie. WHERE MYFIELD EQ &MYVARIABLE.QUOTEDSTRINGWink, the variable-value FOC_NONE (meaning "ignore this line") gets transformed into the string 'FOC_NONE' and treated as a value from then on (the above then reads WHERE MYFIELD EQ 'FOC_NONE') - the line is no longer ignored. Most likely that will cause your TABLE-request to return no rows.

There are good uses for .QUOTEDSTRING, but it can lead to surprising (unwanted) results. Personally, I usually limit usage of .QUOTEDSTRING to drilldown definitions, which is FOCUS code where you may actually want the value FOC_NONE to be passed on to the next procedure. But even there, it's possibly better to leave that to a -DEFAULT in the next procedure and let the FOC_NONE value cause the line with the relevant parameter to be ignored.

With regards to using .QUOTEDSTRING in dialog manager code - what's the point? DM treats everything as strings already anyway, adding .QUOTEDSTRING does nothing there. There are exceptions of course, usually when you need to add explicit quoting or to escape quotes within the string value.

My advice: Don't use .QUOTEDSTRING unless you actually need it. That's opposite of what Susannah advices, I know Wink


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Master
posted Hide Post
I agree with Wep. ( Hi, Wep ! )

We used to do this:

Get the values...
Then add a ' at the beginning and at the end. And replace all , with ' OR '

or when the values already are quoted also replace all ' with ''

Effectively turning 01a,01b into ''01a' OR '01b''

Or even better...

Did you get the values from HTML?
In that case use a TEXTAREA instead of a INPUT. This will open the possibility to switch on the "multiple" option. And the 'add quotes' option.

This will allow the end-user to either enter:

01a,02b

or

01a;02b

or even

01a
02b

G'luck,
Dave


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report 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     [SOLVED] If statement with an in condition

Copyright © 1996-2020 Information Builders