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.
Argh! I've been trying for the last few hours to convert the following SQL CASE statement into a form of If Then Else logic that WebFOCUS will accept! Any ideas? Is there a rule-of-thumb to follow?
Here is the SQL code:
CASE WHEN (ENG_SOP < 1960) THEN
CASE WHEN ((POP_YR - ENG_LIF_YRS) > 1960) THEN
CASE WHEN ((1996 - (POP_YR - ENG_LIF_YRS)) < 1.0) THEN (1.0)
WHEN ((1996 - (POP_YR - ENG_LIF_YRS)) >= 1.0) THEN (1996 - (POP_YR - ENG_LIF_YRS)) END
WHEN ((POP_YR - ENG_LIF_YRS) <= 1960) THEN (1996 - 1960) END
WHEN (ENG_SOP >= 1960) THEN
CASE WHEN ((POP_YR - ENG_LIF_YRS) > ENG_SOP) THEN
CASE WHEN ((1996 - (POP_YR - ENG_LIF_YRS)) < 1.0) THEN (1.0)
WHEN ((1996 - (POP_YR - ENG_LIF_YRS)) >= 1.0) THEN (1996 - (POP_YR - ENG_LIF_YRS)) END
WHEN ((POP_YR - ENG_LIF_YRS) <= ENG_SOP) THEN
CASE WHEN ((1996 - ENG_SOP) < 1.0) THEN (1.0)
WHEN ((1996 - ENG_SOP) >= 1.0) THEN (1996 - ENG_SOP) END
ELSE 1.0 END END AS 'DAN'
Thanks!
DanThis message has been edited. Last edited by: Dan Pinault,
7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007
VAL/D12.1 = IF (((POP_YR - ENG_LIF_YRS) GT 1960) OR ((POP_YR - ENG_LIF_YRS) GT ENG_SOP)) AND
((1996 - (POP_YR - ENG_LIF_YRS)) LT 1.0) THEN (1.0) ELSE
IF (((POP_YR - ENG_LIF_YRS) GT 1960) OR ((POP_YR - ENG_LIF_YRS) GT ENG_SOP)) AND
((1996 - (POP_YR - ENG_LIF_YRS)) GE 1.0) THEN (1996 - (POP_YR - ENG_LIF_YRS)) ELSE
IF ((ENG_SOP LT 1960) AND ((POP_YR - ENG_LIF_YRS) LE 1960)) THEN (1996 - 1960) ELSE
IF ((ENG_SOP GE 1960) AND ((POP_YR - ENG_LIF_YRS) LE ENG_SOP) AND
((1996 - ENG_SOP) LT 1.0)) THEN (1.0) ELSE
IF ((ENG_SOP GE 1960) AND ((POP_YR - ENG_LIF_YRS) LE ENG_SOP) AND
((1996 - ENG_SOP) GE 1.0)) THEN (1996 - ENG_SOP) ELSE (1.0);
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007
I didn't see a valid case where the final "ELSE 1.0" in the original code would apply as either (POP_YR - ENG_LIF_YRS) > ENG_SOP or (POP_YR - ENG_LIF_YRS) <= ENG_SOP would be met in any case, so I did not make a provision for that one.
Hope that helps,
- Neftali.This message has been edited. Last edited by: njsden,
I guess I couldn't see the forest for the trees as the saying goes. I was stuck on trying to convert the statement as it was written. The though or rearranging it never occured to me. Doh!
Regards!
Dan
7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
Posts: 393 | Location: St. Paul, MN | Registered: November 06, 2007