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]-SET commands for dates and date routines

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]-SET commands for dates and date routines
 Login/Join
 
Guru
posted
I have the following defines set up and need to use it in four separate defines that read four different tables. Instead of copying these defines to the four separate define file sections, is there a way to convert some of these defines to -SET commands? When I converted the DATEADD defines to -SET commands, the date values in the subsequent defines return an integer date instead of the correct YYMD date. Thanks.
 
END_DATE/YYMD       = '&END_RPT_DATE';
DATE12/I8YYMD       = END_DATE;
DATE11/I8YYMD       = DATEADD (END_DATE, 'M', -11);
DATE10/I8YYMD       = DATEADD (END_DATE, 'M', -10);
DATE9/I8YYMD        = DATEADD (END_DATE, 'M', -9);
DATE8/I8YYMD        = DATEADD (END_DATE, 'M', -8);
DATE7/I8YYMD        = DATEADD (END_DATE, 'M', -7);
DATE6/I8YYMD        = DATEADD (END_DATE, 'M', -6);
DATE5/I8YYMD        = DATEADD (END_DATE, 'M', -5);
DATE4/I8YYMD        = DATEADD (END_DATE, 'M', -4);
DATE3/I8YYMD        = DATEADD (END_DATE, 'M', -3);
DATE2/I8YYMD        = DATEADD (END_DATE, 'M', -2);
DATE1/I8YYMD        = DATEADD (END_DATE, 'M', -1);
-*
START_Q1/YYMD       = '&DATE11';
START_Q2/YYMD       = DATE8;
START_Q3/YYMD       = DATE5;
START_Q4/YYMD       = DATE2;
-*
MOEND_Q1/YYMD       = DATE9;
MOEND_Q2/YYMD       = DATE6;
MOEND_Q3/YYMD       = DATE3;
-*
ALPHA_Q1/A8YYMD     = EDIT(DATE9);
ALPHA_Q2/A8YYMD     = EDIT(DATE6);
ALPHA_Q3/A8YYMD     = EDIT(DATE3);
ALPHA_Q4/A8YYMD     = EDIT(DATE12);
-*
Q1_YEAR/A4          = EDIT(ALPHA_Q1,'9999');
Q2_YEAR/A4          = EDIT(ALPHA_Q2,'9999');
Q3_YEAR/A4          = EDIT(ALPHA_Q3,'9999');
Q4_YEAR/A4          = EDIT(ALPHA_Q4,'9999');
-*
Q1_HEADING/A7       = 'Q1 '|Q1_YEAR;
Q2_HEADING/A7       = 'Q2 '|Q2_YEAR;
Q3_HEADING/A7       = 'Q3 '|Q3_YEAR;
Q4_HEADING/A7       = 'Q4 '|Q4_YEAR;
-*
END_Q1/YYMD         = DATEMOV(MOEND_Q1,'EOM');
END_Q2/YYMD         = DATEMOV(MOEND_Q2,'EOM');
END_Q3/YYMD         = DATEMOV(MOEND_Q3,'EOM');
END_Q4/YYMD         = DATEMOV(END_DATE,'EOM');
-*
BEG_Q1/YYMD         = DATEMOV(START_Q1,'BOM');
BEG_Q2/YYMD         = DATEMOV(START_Q2,'BOM');
BEG_Q3/YYMD         = DATEMOV(START_Q3,'BOM');
BEG_Q4/YYMD         = DATEMOV(START_Q4,'BOM');
-*
QTR_PERIOD/I1       = IF (RPRT_DATE GE BEG_Q1) AND (RPRT_DATE LE END_Q1) THEN 1 ELSE
                      IF (RPRT_DATE GE BEG_Q2) AND (RPRT_DATE LE END_Q2) THEN 2 ELSE
					  IF (RPRT_DATE GE BEG_Q3) AND (RPRT_DATE LE END_Q3) THEN 3 ELSE
					  IF (RPRT_DATE GE BEG_Q4) AND (RPRT_DATE LE END_Q4) THEN 4 ELSE 0;

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
You can't use Date and Date/Time functions in Dialogue Manager as easily as you can in DEFINE and COMPUTE. You have to use DATECVT to convert from string to date, then use the Date or Date/Time function, then use DATECVT to convert back to string.

In your case, why not create a fex that you include where needed? In this way you do not have to duplicate code.


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
I've piped in on FocalPoint many times regarding using Date and Date/Time functions with Dialogue Manager. Like this example:

-SET &DATEIN = '20150328';
-SET &DATEADD6 = DATECVT((DATEADD((DATECVT(&DATEIN, 'I8YYMD', 'YYMD')), 'D', 6)), 'YYMD', 'I8YYMD');
-TYPE IN: &DATEIN / OUT: &DATEADD6

The innermost DATECVT function call converts the string value &DATEIN to a smart date. Then the DATEADD function runs and then the outermost DATECVT function converts the smart date back to a string.


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
Guru
posted Hide Post
Francis, thanks so much. I'll create a define to include in the fex. Great suggestion. Thanks.


WF 8205, Windows 10
Oracle DBMS
EXL07/PDF Output
 
Posts: 244 | Registered: August 27, 2012Report This Post
Expert
posted Hide Post
Also don't forget, that you can create DEFINE FUNCTIONS


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report 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]-SET commands for dates and date routines

Copyright © 1996-2020 Information Builders