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] Last Month for CUBE

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Last Month for CUBE
 Login/Join
 
Platinum Member
posted
I am writing a reporting object that uses CUBE. I need to put a condition where the month = Last month (which is last partion). This is proving difficult.

Please does anyone know how this can be done? Thanks

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


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
 
Posts: 117 | Registered: November 18, 2009Report This Post
Platinum Member
posted Hide Post
I can get last month by using system date. But the problem is that system last month may not be last month in cube. For example, last month is Jan 2010 but my cube has last month as Dec 2009.

I am looking for ways for the report to pick cube's last month. Thanks.


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
 
Posts: 117 | Registered: November 18, 2009Report This Post
Platinum Member
posted Hide Post
Here is an example of what I want to do:
-SET &VAR_MONTH = -1;
TABLE FILE TEST_REPORT
SUM
TOTAL_OUTSTANDING_AMT
BY COUNTRY
BY BRAND
ACROSS MONTH
WHERE MONTH EQ '&LAST_DT');

The &VAR_MONTH value needs to either be -1 or -2. If &VAR_MONTH = -1 and no record is return, then let &VAR_MONTH= -2.

Please, guys any suggestions on how I can achieve this?

Thank you.

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


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
 
Posts: 117 | Registered: November 18, 2009Report This Post
Platinum Member
posted Hide Post
Here is what I have tried but not successful. Please can someone check to see what could be wrong. The data source is anaylysis cube.

Thank you.

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


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
 
Posts: 117 | Registered: November 18, 2009Report This Post
Virtuoso
posted Hide Post
Here are two possible solutions. The first uses a multi-verb request to find the most recent MONTH in your table and then uses that value (C1 = Column 1) to produce the report. The second saves the latest MONTH value to a variable, which is used in the WHERE clause of the subsequent report request.

#1:
TABLE FILE TEST_REPORT
 SUM MAX.MONTH NOPRINT
 SUM TOTAL_OUTSTANDING_AMT
 BY COUNTRY
 BY BRAND
 ACROSS MONTH
 WHERE MONTH EQ C1 ;
END


#2:
TABLE FILE TEST_REPORT
 SUM MAX.MONTH
 ON TABLE SAVE
END
-*
-RUN
-READ SAVE, &LASTMONTH
-*
TABLE FILE TEST_REPORT
 SUM TOTAL_OUTSTANDING_AMT
 BY COUNTRY
 BY BRAND
 ACROSS MONTH
 WHERE MONTH EQ '&LASTMONTH';
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by Dan Satchell:
Here are two possible solutions. The first uses a multi-verb request to find the most recent MONTH in your table and then uses that value (C1 = Column 1) to produce the report. The second saves the latest MONTH value to a variable, which is used in the WHERE clause of the subsequent report request.

#1:
TABLE FILE TEST_REPORT
 SUM MAX.MONTH NOPRINT
 SUM TOTAL_OUTSTANDING_AMT
 BY COUNTRY
 BY BRAND
 ACROSS MONTH
 WHERE MONTH EQ C1 ;
END


#2:
TABLE FILE TEST_REPORT
 SUM MAX.MONTH
 ON TABLE SAVE
END
-*
-RUN
-READ SAVE, &LASTMONTH
-*
TABLE FILE TEST_REPORT
 SUM TOTAL_OUTSTANDING_AMT
 BY COUNTRY
 BY BRAND
 ACROSS MONTH
 WHERE MONTH EQ '&LASTMONTH';
END


Hi Dan,
I have been able to resolve the issue. Thank you. But I used "ON TABLE HOLD AS HOLDTEST FORMAT FOCUS" instead of "ON TABLE SAVE" and I didn't use the -RUN command. Is there any difference? what is the effect of the -RUN command?

Thank you


WebFOCUS 7.7.02
Windows/SQL/CUBES
HTML/PDF/XLS
 
Posts: 117 | Registered: November 18, 2009Report This Post
Virtuoso
posted Hide Post
quote:
But I used "ON TABLE HOLD AS HOLDTEST FORMAT FOCUS" instead of "ON TABLE SAVE" and I didn't use the -RUN command. Is there any difference? what is the effect of the -RUN command?

ON TABLE HOLD FORMAT FOCUS saves the results in a FOCUS file, which cannot be read in any meaningful way with a -READ. ON TABLE SAVE saves the results in a text file which can be read with -READ.

As WebFOCUS reads the statements in a focexec, standard commands and statements (TABLE FILE, etc.) are put into the FOCSTACK for later execution, and Dialogue Manager statements, which all begin with a dash, are executed immediately. The statements in the FOCSTACK are executed when the end of the focexec is reached, or whenver a -RUN is encountered.

In the example I provided, without the -RUN, the TABLE FILE...ON TABLE SAVE would be put in the FOCSTACK and the -READ would execute immediately. This would result in an error message about the SAVE file not existing.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 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] Last Month for CUBE

Copyright © 1996-2020 Information Builders