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 logic

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]IF THEN ELSE logic
 Login/Join
 
Guru
posted
I have a define that has the following statement and it does not return the correct results.

RPT_FLAG/A1 = IF (STATUS_FLAG EQ 'P') AND (INVOICE_DATE NE ' ') AND
(SEND_STATUS EQ ' ') THEN 'Y' ELSE
IF (STATUS_FLAG EQ 'X') AND (NEXT_BILL_ID NE ' ') AND
(INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ')
THEN 'Y' ELSE 'N';

The second part of the if then else logic is returning an 'N' when it should be a 'Y'. I need the RPT_FLAG to return a 'Y' if the first if then else logic is met OR if the second if then else logic is met.

This message has been edited. Last edited by: Michele Brooks,


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Expert
posted Hide Post
The syntax looks correct (I rearranged the clauses slightly):
RPT_FLAG/A1 = 
     IF (STATUS_FLAG EQ 'P') AND (INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ') THEN 'Y' 
ELSE IF (STATUS_FLAG EQ 'X') AND (INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ') AND (NEXT_BILL_ID NE ' ') THEN 'Y' 
ELSE 'N';

Perhaps one or more of the values are null and not blank as you're expecting.


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
Master
posted Hide Post
You should print out each of the fields and verify their values. MISSING data may be part of the issue, and as it is a DEFINE the verb (PRINT vs SUM) may also come into play.

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




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Guru
posted Hide Post
quote:
RPT_FLAG/A1 =
IF (STATUS_FLAG EQ 'P') AND (INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ') THEN 'Y'
ELSE IF (STATUS_FLAG EQ 'X') AND (INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ') AND (NEXT_BILL_ID NE ' ') THEN 'Y'
ELSE 'N';


I did that. That is how I could tell that the logic was not working correctly. Francis' suggestion solved the problem. Thank you.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Guru
posted Hide Post
You are the best. Your logic worked. I would have never thought of rearranging my logic. Pasted below is my alternative method, a bit lengthy but it also works. Thanks so much. I hate to have more code than necessary is my programs. I was close this case as [SOLVED]. Thanks again.

REPORTABLE_FLAG_P/I4 = IF (STATUS_FLAG EQ 'P') AND (INVOICE_DATE NE ' ') AND
(SEND_STATUS EQ ' ') THEN 1 ELSE 0;
REPORTABLE_BILL_FLAG_X/I4 = IF (STATUS_FLAG EQ 'X') AND (NEXT_BILL_ID NE ' ') AND
(INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ') THEN 1 ELSE 0;
REPT_BILL_FLAG/I4 = REPORTABLE_BILL_FLAG_P + REPORTABLE_BILL_FLAG_X;
REPORTABLE_BILL_FLAG/A1 = IF REPT_BILL_FLAG NE 0 THEN 'Y' ELSE 'N';


quote:
Originally posted by Francis Mariani:
The syntax looks correct (I rearranged the clauses slightly):
RPT_FLAG/A1 = 
     IF (STATUS_FLAG EQ 'P') AND (INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ') THEN 'Y' 
ELSE IF (STATUS_FLAG EQ 'X') AND (INVOICE_DATE NE ' ') AND (SEND_STATUS EQ ' ') AND (NEXT_BILL_ID NE ' ') THEN 'Y' 
ELSE 'N';

Perhaps one or more of the values are null and not blank as you're expecting.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report 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 logic

Copyright © 1996-2020 Information Builders