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-then-else

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] if-then-else
 Login/Join
 
Platinum Member
posted
I need to construct some logic to check a 12 month period and display the first value that is greater than zero. In my if-then logic I need it to stop after the first value is found.

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


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
Virtuoso
posted Hide Post
Donald...I think we need a little more detail here...or maybe it's just been a long day.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Platinum Member
posted Hide Post
Yes its been a long day. But what I need to do is check 12 monthly buckets (Jan - December) If the value in January is greater than zero display that value. But if January is zero I need to check each bucket until I have a value. If there is no value in any of the 12 months then display a zero. For example:If there is a value in February I need to stop so I don't add March. I need to display February and stop processing.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
Expert
posted Hide Post
These buckets, are they columns or are they rows?

Columns:

Jan  Feb  Mar  Apr  etc.
---- ---- ---- ----
0000 0001 0002 0001 etc.

Rows:

Month Amount
----- ------
01      0000
02      0001
03      0002
04      0001
etc.


If they're rows and you have the month as a column, this may work:

SUM
AMOUNT
BY LOWEST 1 MONTH
WHERE AMOUNT GT 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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
If they're columns, then this might work:

NEWAMT/D6 = 
IF JANAMT GT 0 THEN JANAMT ELSE
IF FEBAMT GT 0 THEN FEBAMT ELSE
IF MARAMT GT 0 THEN MARAMT ELSE
IF APRAMT GT 0 THEN APRAMT ELSE
IF MAYAMT GT 0 THEN MAYAMT ELSE
IF JUNAMT GT 0 THEN JUNAMT ELSE
IF JULAMT GT 0 THEN JULAMT ELSE
IF AUGAMT GT 0 THEN AUGAMT ELSE
IF SEPAMT GT 0 THEN SEPAMT ELSE
IF OCTAMT GT 0 THEN OCTAMT ELSE
IF NOVAMT GT 0 THEN NOVAMT ELSE DECAMT;


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
The buckets are in columns, so the problem is that,if for example FEBAMT was greater than zero, instead of ending, it still checks MARAMT therefore NEWAMT is then overstated.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report This Post
<JG>
posted
quote:
NEWAMT/D6 =
IF JANAMT GT 0 THEN JANAMT ELSE
IF FEBAMT GT 0 THEN FEBAMT ELSE
IF MARAMT GT 0 THEN MARAMT ELSE
IF APRAMT GT 0 THEN APRAMT ELSE
IF MAYAMT GT 0 THEN MAYAMT ELSE
IF JUNAMT GT 0 THEN JUNAMT ELSE
IF JULAMT GT 0 THEN JULAMT ELSE
IF AUGAMT GT 0 THEN AUGAMT ELSE
IF SEPAMT GT 0 THEN SEPAMT ELSE
IF OCTAMT GT 0 THEN OCTAMT ELSE
IF NOVAMT GT 0 THEN NOVAMT ELSE DECAMT;


Donald, Francis's solution does what you want, except it should end

IF NOVAMT GT 0 THEN NOVAMT ELSE
IF DECAMT GT 0 THEN DECAMT ELSE 0;

IF - THEN - ELSE terminates processing as soon as a condition (either posative or negative) is met.
 
Report This Post
Guru
posted Hide Post
Donald,

You also may want to try and add the absolute value of each month together and check if that is zero.

Fernando


Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
 
Posts: 278 | Registered: October 10, 2006Report This Post
Expert
posted Hide Post
JG,

Could you kindly explain why
NEWAMT/D6 =
IF JANAMT GT 0 THEN JANAMT ELSE
IF FEBAMT GT 0 THEN FEBAMT ELSE
IF MARAMT GT 0 THEN MARAMT ELSE
IF APRAMT GT 0 THEN APRAMT ELSE
IF MAYAMT GT 0 THEN MAYAMT ELSE
IF JUNAMT GT 0 THEN JUNAMT ELSE
IF JULAMT GT 0 THEN JULAMT ELSE
IF AUGAMT GT 0 THEN AUGAMT ELSE
IF SEPAMT GT 0 THEN SEPAMT ELSE
IF OCTAMT GT 0 THEN OCTAMT ELSE
IF NOVAMT GT 0 THEN NOVAMT ELSE DECAMT;

should be

NEWAMT/D6 =
IF JANAMT GT 0 THEN JANAMT ELSE
IF FEBAMT GT 0 THEN FEBAMT ELSE
IF MARAMT GT 0 THEN MARAMT ELSE
IF APRAMT GT 0 THEN APRAMT ELSE
IF MAYAMT GT 0 THEN MAYAMT ELSE
IF JUNAMT GT 0 THEN JUNAMT ELSE
IF JULAMT GT 0 THEN JULAMT ELSE
IF AUGAMT GT 0 THEN AUGAMT ELSE
IF SEPAMT GT 0 THEN SEPAMT ELSE
IF NOVAMT GT 0 THEN NOVAMT ELSE
IF DECAMT GT 0 THEN DECAMT ELSE 0; 

I see no reason for this. DECAMT could be greater than or equal to zero - my and your code will evaluate to the correct value.

Thanks,


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
FM -
I agree with (the other) JG. Donald expects a non-negaive result, and did not say that the buckets can't be negative. If (say) all 12 were neg, the result should be zero or missing, but not December's value.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
Yup, you're right about negative values.

Cheers to both J.G.'s.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Thanks everyone, it works well with the if-then and the ending condition of 0.


Prod: WebFocus 7.7.3 Win 2003
Dev: WebFocus 7.7.3 Win 2003
 
Posts: 116 | Registered: April 23, 2007Report 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-then-else

Copyright © 1996-2020 Information Builders