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.
I need to filter data based on two date ranges as follows. I need to know where to put the parenthesis.
WHERE OPENDATE GE STARTDATE AND OPENDATE LE ENDDATE OR
CLDDATE GE STARTDATE AND CLDDATE LE ENDDATE
I also need to do the same thing in a define
DEFINE FILE
QTR/I1 = IF OPENDATE GE Q1_BEG AND OPENDATE LE Q1_END OR CLDDATE GE Q1_BEG AND CLDDATE LE Q1_END THEN 1 ELSE
IF OPENDATE GE Q2_BEG AND OPENDATE LE Q2_END OR CLDDATE GE Q2_BEG AND CLDDATE LE Q2_END THEN 2 ELSE
IF OPENDATE GE Q3_BEG AND OPENDATE LE Q3_END OR CLDDATE GE Q3_BEG AND CLDDATE LE Q3_END THEN 3 ELSE
IF OPENDATE GE Q4_BEG AND OPENDATE LE Q4_END OR CLDDATE GE Q4_BEG AND CLDDATE LE Q4_END THEN 4 ELSE 0;
Thanks.This message has been edited. Last edited by: Michele Brooks,
WHERE (OPENDATE GE STARTDATE AND OPENDATE LE ENDDATE) OR
(CLDDATE GE STARTDATE AND CLDDATE LE ENDDATE)
QTR/I1 =
IF (OPENDATE GE Q1_BEG AND OPENDATE LE Q1_END) OR (CLDDATE GE Q1_BEG AND CLDDATE LE Q1_END) THEN 1
ELSE IF (OPENDATE GE Q2_BEG AND OPENDATE LE Q2_END) OR (CLDDATE GE Q2_BEG AND CLDDATE LE Q2_END) THEN 2
ELSE IF (OPENDATE GE Q3_BEG AND OPENDATE LE Q3_END) OR (CLDDATE GE Q3_BEG AND CLDDATE LE Q3_END) THEN 3
ELSE IF (OPENDATE GE Q4_BEG AND OPENDATE LE Q4_END) OR (CLDDATE GE Q4_BEG AND CLDDATE LE Q4_END) THEN 4
ELSE 0;
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
In my experience as a programmer, AND logic usually is evaluated first, then OR logic. So I'm curious as to whether it would still work without parentheses.
That being said, it's much easier to read and understand with parentheses, as the example Francis gave demonstrates.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
I agree with Waz - always use brackets, but once in a while the ORs and ANDs get more complicated than my tiny brain can accommodate, specially when several variables have to be in place to get the correct result.
In that case I split up the logic and assign a numeric flag to each individual result. Checking the value of the sum of the flags allows me to produce the result desired.
George, I think what you are suggesting is setting flags in a DEFINE section and testing the database fields there. Then in the WHERE section test just those flags. That's a great idea.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015