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     Working with Quarters in Dialog Manager variables

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Working with Quarters in Dialog Manager variables
 Login/Join
 
Expert
posted
In the past, I've shown how to use some date functions in Dialog Manager by first converting the DM variable to a smart date.

I cannot figure out a simple, clean way to manipulate Quarters in DM variables.

I would like to take a DM variable with a value like '2004 Q2' and add or subtract a number of quarters from it without using IF-THEN-ELSE.

Any ideas?


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
We can define our own QADD function...
(and use it with DM, DEFINE or COMPUTE)

-* Add or subtract quarters. - 2005.11.16 - Mikel Gómez
DEFINE FUNCTION QADD(YYQ/A7, DIF/I2)
YEAR1/I4 = EDIT(EDIT(YYQ, '9999')) ;
QUARTER1/I1 = EDIT(EDIT(YYQ, '$$$$$$9')) ;
OPER/I9 = YEAR1 * 4 + QUARTER + DIF - 1 ;
YEAR2/I4 = INT(OPER / 4) ;
MONTH2/I1 = IMOD(OPER, 4, 'I1') + 1;
QADD/A7 = EDIT(YEAR2) | ' Q' | EDIT(MONTH2) ;
END
-RUN

-* Example:
-SET &Q = '2005 Q3' ;
-TYPE QADD examples:

-SET &Q1 = QADD(&Q, 1) ;
-TYPE &Q + 1 = &Q1

-SET &Q2 = QADD(&Q, 2) ;
-TYPE &Q + 2 = &Q2

-SET &Q2 = QADD(&Q, -4) ;
-TYPE &Q - 4 = &Q2

-SET &Q3 = QADD(&Q, -20) ;
-TYPE &Q - 20 = &Q3


WebFOCUS 8.1.05, 8.2.01
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
Guru
posted Hide Post
Don't if this will help but it could give you an idea:

-* Set the Start and End date for QUARTER.
-* Default date is yesterday.
-SET &DT = AYMD(&YYMD,-1,'I8');
-* Change value to work with date manipulation.
-SET &TIME_BACK = &TIME_BACK * 3;
-SET &TIME_DURA = (&TIME_DURA - 1) * 3;
-* Produce the end date and start date.
-SET &END_YYMD = DATECVT((DATEMOV(DATEADD((DATECVT
-  (&DT,'I8YYMD','YYMD')),'M',-&TIME_BACK),'EOQ')),'YYMD','I8YYMD');
-SET &START_YYMD = DATECVT((DATEMOV(DATEADD((DATECVT
-  (&END_YYMD,'I8YYMD','YYMD')),'M',-&TIME_DURA),'BOQ')),'YYMD','I8YYMD');
-RUN
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
Expert
posted Hide Post
Thanks!

I didn't realize that a DEFINEd function could be used in Dialog Manager - wonders never cease!


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
The Documentation States it doesn't. hmmm

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


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
<Jeff T>
posted
Thanks. The Documentation will be corrected. The following will be removed from the Creating Reports With WebFOCUS Language manual:
"You cannot call DEFINE functions from Dialogue Manager commands."
 
Report This Post
Guru
posted Hide Post
And here I never used it, because I only saw a use for it in DM!


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report 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     Working with Quarters in Dialog Manager variables

Copyright © 1996-2020 Information Builders