Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Selective WHERE
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Selective WHERE
 Login/Join
 
Gold member
posted
In the sample code below, I want the YTDSALES field to disregard the WHERE selection for MONTH EQ '08' i.e. I want the WHERE MONTH EQ '08' to apply to the MTDSALES and BUDGETSALES fields but for YTDSALES field, I want it to add up values WHERE MONTH LE '08' or disregard the MONTH EQ '08' statement all together. Any suggestions on how this can be achieved?


TABLE FILE SALES
SUM
MTDSALES
YTDSALES
BUDGETSALES
BY REGION
BY COSTCENTER
WHERE COSTCENTER EQ 'ABC'
WHERE MONTH EQ '08'
END

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


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
 
Posts: 69 | Registered: March 11, 2010Reply With QuoteReport This Post
Expert
posted Hide Post
Pretty simple. I would assume(probably incorrectly) that you are "NOT" hard-coding the Month, so I will assume it is another ampere variable, along with a Year(maybe?):

TABLE FILE SALES
SUM
  COMPUTE XMTDSALES/P13.2MC    = IF YEAR EQ '&YEAR' AND MONTH EQ '&MONTH' THEN MTDSALES    ELSE 0; AS 'MTDSALES'
  COMPUTE XYTDSALES/P13.2MC    = IF YEAR EQ '&YEAR' AND MONTH LE '&MONTH' THEN YTDSALES    ELSE 0; AS 'YTDSALES'
  COMPUTE XBUDGETSALES/P13.2MC = IF YEAR EQ '&YEAR' AND MONTH EQ '&MONTH' THEN BUDGETSALES ELSE 0; AS 'BUDGETSALES'
  COMPUTE FLAG/A1              = IF XMTDSALES EQ 0 AND XYTDSALES EQ 0 AND XBUDGETSALES EQ 0 THEN 'N' ELSE 'Y'; NOPRINT
BY REGION
BY COSTCENTER
WHERE COSTCENTER EQ 'ABC';
WHERE TOTAL FLAG EQ 'Y';
-* WHERE MONTH EQ '08'

END


WHERE statements end with a semi-colon, though, until IBI does some code-tightening, it will work without one.


hth

Tom


Tom Flynn
WebFOCUS 7.7.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1946 | Location: Parker, CO | Registered: January 31, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
Yes, I am using amper variables. This should work. Thanks!


WebFOCUS 7.6.10
Windows
all output (Excel, HTML, PDF)
 
Posts: 69 | Registered: March 11, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Selective WHERE

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.