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     Formatting Parameter

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Formatting Parameter
 Login/Join
 
Silver Member
posted
Good afternoon all, I am trying to set a parameter that gives me a date using a year back. This is the code I have. However, for my NEWEND it is giving me 20050995 in stead of 20060601. Can someone tell me how I can get this to work?

-SET &BSTART =1;
-SET &BEND =1;
-*-THIS IS TO GET THE QTC RECORDS
-SET &OFFSET = IF &MONTH EQ 01 OR 04 OR 07 OR 10 THEN -2 ELSE 99;
-SET &OFFSET = IF &MONTH EQ 02 OR 05 OR 08 OR 11 THEN -1 ELSE 99;
-SET &OFFSET = IF &MONTH EQ 03 OR 06 OR 09 OR 12 THEN 0 ELSE 99;

-SET &OFFSET2 = IF &MONTH EQ 01 OR 04 OR 07 OR 10 THEN 12 ELSE 99;
-SET &OFFSET2 = IF &MONTH EQ 02 OR 05 OR 08 OR 11 THEN 11 ELSE 99;
-SET &OFFSET2 = IF &MONTH EQ 03 OR 06 OR 09 OR 12 THEN 10 ELSE 99;

-*SET &BSTART=&PBSTART;
-*SET &PB = &BSTART;
-SET &PB = &BSTART + &OFFSET;
-MRNOEDIT -INCLUDE SDRYYMD
-SET &BEG1 = &BEGMTH_YYMD;
-*SET &BEND = &PBEND;
-*SET &PB = &BEND;
-SET &PB = &BEND + &OFFSET2;
-MRNOEDIT -INCLUDE SDRYYMD
-SET &ENDDATE = &ENDMTH_YYMD;
-SET &ENMNTH = EDIT(&ENDDATE,'$$$$99$$');
-SET &ENYEAR = EDIT(&ENDDATE,'9999$$$$');
-SET &ENDAYYEAR = IF (ENYEAR EQ '2003' OR '2007') AND (ENMNTH GT '02') THEN 366 ELSE 365;
-SET &NEWEND = &ENDAYYEAR + &ENDDATE;
-*SET &END1 = &NEWEND;


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Guru
posted Hide Post
It's a little hard to debug your code since you don't state what the input values are and what is the code in the SDRYYMD file?

Have you tried using the DATEMOV or DATEADD functions? They maybe what you are looking for to make your code a lot easier.

Here are links to doc's on the tech support site:
http://documentation.informationbuilders.com/masterinde...t_520/datetime11.htm
http://documentation.informationbuilders.com/masterinde...ctions713/datea4.htm

This message has been edited. Last edited by: reFOCUSing,
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
Silver Member
posted Hide Post
Thanks, I will look at this.

Actually the SDRYYMD file is just dates formated for days, month, fiscal year. This allows me to say where PB + 3 (period back) for three days back, 3 months back, etc). Unfortunately it does not have "future" dates in which I need for a as of date range period for 04/01/2006 that will end on 06/30/2006.


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Guru
posted Hide Post
I did something like what you are doing a couple years ago. Give this code a try and see if it works.

-* Name         : Date Definition Setup
-* Product      : WebFOCUS
-* Executed     : on request
-* Created by   : reFOCUSing
-* Created on   : June 28/2004
-* Parameters   :
-*    &TIME_TYPE: Can have the value of 'YEAR', 'QUARTER', 'MONTH', 'WEEK' or 'DAY'
-*    &TIME_DRCT: Can have the value of 'FRWD' or 'BACK'
-*    &TIME_STRT: 0 to x.
-*    &TIME_DURA: 0 to x.
-* Output file  : none
-* Description  :
-*    This is the variable setup for the dates that will be used in WHERE
-*     statements and any other commonly used variables in reports.
-* Maintenance  :
-*   June 28 File created.
-*
-***********VARIALBES***********************************************

-* Initializing procedure.
-DEFAULT &TIME_TYPE = 'MONTH'
-DEFAULT &TIME_DRCT = 'FRWD'
-DEFAULT &TIME_STRT = 4
-DEFAULT &TIME_DURA = 2

-* Display unformatted user input.
-TYPE Unformated User Inputs:
-TYPE TIME_TYPE '&TIME_TYPE', TIME_DRCT '&TIME_DRCT'
-TYPE TIME_STRT '&TIME_STRT', TIME_DURA '&TIME_DURA'
-RUN

-* Error checking.
-* Checking the input of &TIME_TYPE.
-* Change text to uppercase.
-* The default is DAY.
-SET &LEN = '''A' | &TIME_TYPE.LENGTH | '''';
-SET &TIME_TYPE = UPCASE(&TIME_TYPE.LENGTH, &TIME_TYPE, &LEN.EVAL);
-SET &TIME_TYPE =
-IF '&TIME_TYPE.EVAL' EQ 'YEAR' OR 'QUARTER' OR 'MONTH' OR 'WEEK' OR 'DAY'
-  THEN &TIME_TYPE
-ELSE 'DAY';
-RUN

-* Checking the input of &TIME_DRCT.
-* Change text to uppercase
-* The default is BACK.
-SET &LEN = '''A' | &TIME_DRCT.LENGTH | '''';
-SET &TIME_DRCT = UPCASE(&TIME_DRCT.LENGTH, &TIME_DRCT, &LEN.EVAL);
-SET &TIME_DRCT =
-IF '&TIME_DRCT.EVAL' EQ 'BACK' OR 'FRWD'
-  THEN &TIME_DRCT
-ELSE 'BACK';
-RUN

-* Checking the input of &TIME_STRT.
-* The default is 0.
-SET &TIME_STRT =
-IF ASIS(&TIME_STRT) LT 0 OR &TIME_STRT.TYPE EQ 'A' THEN 0 ELSE &TIME_STRT;
-SET &TIME_STRT =
-IF '&TIME_DRCT.EVAL' EQ 'BACK' THEN -&TIME_STRT ELSE &TIME_STRT;
-RUN

-* Checking the input of &TIME_DURA.
-* The default is 1.
-SET &TIME_DURA =
-IF ASIS(&TIME_DURA) LT 1 OR &TIME_DURA.TYPE EQ 'A' THEN 1 ELSE &TIME_DURA;
-RUN

-* GOTO specific date creation.
-GOTO :SET_&TIME_TYPE

-:SET_YEAR
-***********SET YEAR************************************************
-* Set the Start and End date for YEAR.
-* Default date is today.
-SET &DT = AYMD(&YYMD,0,'I8');
-* Change value to work with date manipulation.
-SET &TIME_DURA = &TIME_DURA - 1;
-* Produce the start date and end date.
-SET &START_YYMD = DATECVT((DATEMOV((DATEADD((DATECVT(&DT,'I8YYMD','YYMD')),'Y',&TIME_STRT)),'BOY')),'YYMD','I8YYMD');
-SET &END_YYMD = DATECVT((DATEMOV((DATEADD((DATECVT(&START_YYMD,'I8YYMD','YYMD')),'Y',&TIME_DURA)),'EOY')),'YYMD','I8YYMD');
-RUN
-GOTO :SET_TIME

-:SET_QUARTER
-**********SET QUARTER*********************************************
-* Set the Start and End date for QUARTER.
-* Default date is today.
-SET &DT = AYMD(&YYMD,0,'I8');
-* Change value to work with date manipulation.
-SET &TIME_STRT = &TIME_STRT * 3;
-SET &TIME_DURA = (&TIME_DURA - 1) * 3;
-* Produce the start date and end date.
-SET &START_YYMD = DATECVT((DATEMOV(DATEADD((DATECVT(&DT,'I8YYMD','YYMD')),'M',&TIME_STRT),'BOQ')),'YYMD','I8YYMD');
-SET &END_YYMD = DATECVT((DATEMOV(DATEADD((DATECVT(&START_YYMD,'I8YYMD','YYMD')),'M',&TIME_DURA),'EOQ')),'YYMD','I8YYMD');
-RUN
-GOTO :SET_TIME

-:SET_MONTH
-**********SET MONTH***********************************************
-* Set the Start and End date for MONTH.
-* Default date is today.
-SET &DT = AYMD(&YYMD,0,'I8');
-* Change value to work with date manipulation.
-SET &TIME_DURA = &TIME_DURA - 1;
-* Produce the start date and end date.
-SET &START_YYMD = DATECVT((DATEMOV(DATEADD((DATECVT(&DT,'I8YYMD','YYMD')),'M',&TIME_STRT),'BOM')),'YYMD','I8YYMD');
-SET &END_YYMD = DATECVT((DATEMOV(DATEADD((DATECVT(&START_YYMD,'I8YYMD','YYMD')),'M',&TIME_DURA),'EOM')),'YYMD','I8YYMD');
-RUN
-GOTO :SET_TIME

-:SET_WEEK
-**********SET WEEK************************************************
-* Set the Start and End date for WEEK
-* Default date is today.
-SET &DT = AYMD(&YYMD,0,'I8');
-* Change value to work with date manipulation.
-SET &TIME_STRT = &TIME_STRT * 7;
-SET &TIME_DURA = IF &TIME_DURA LT 1 THEN 6 ELSE (&TIME_DURA  * 7) - 1;
-SET &FIRST_W_D = DOWK(&DT, 'A3');
-SET &FIRST_W_D = DECODE &FIRST_W_D(
- 'SUN' '0' 'MON' '1' 'TUE' '2' 'WED' '3' 'THU' '4' 'FRI' '5' 'SAT' '6');
-SET &DT = AYMD(&DT, -&FIRST_W_D, 'I8');
-* Produce the start date and end date.
-SET &START_YYMD = AYMD(&DT, &TIME_STRT, 'I8');
-SET &END_YYMD = AYMD(&START_YYMD, &TIME_DURA, 'I8');
-RUN
-GOTO :SET_TIME

-:SET_DAY
-**********SET DAY*************************************************
-* Set the Start and End date for DAY.
-* Default date is today.
-SET &DT = AYMD(&YYMD,0,'I8');
-* Change value to work with date manipulation.
-SET &TIME_DURA = &TIME_DURA - 1;
-* Produce the start date and end date.
-SET &START_YYMD = AYMD(&DT,&TIME_STRT,'I8');
-SET &END_YYMD = AYMD(&START_YYMD,&TIME_DURA,'I8');
-RUN
-GOTO :SET_TIME

-:SET_TIME
-**********SET TIME************************************************
-* Set the time used.
-* Error check for Date.
-SET &DT = AYMD(&YYMD,0,'I8');
-SET &END_YYMD =
-IF &TIME_DRCT EQ 'BACK' AND &END_YYMD GT &DT THEN &DT ELSE &END_YYMD;
-* Creating other date variables.
-SET &START_YYMD_T = EDIT(&START_YYMD, '9999/99/99') | ' 00:00:00';
-SET &END_YYMD_T   = EDIT(&END_YYMD, '9999/99/99') | ' 23:59:59';
-SET &START_MDYY = EDIT(&START_YYMD, '$$$$9999') | EDIT(&START_YYMD, '9999');
-SET &END_MDYY = EDIT(&END_YYMD,  '$$$$9999') | EDIT(&END_YYMD, '9999');
-RUN

-**********FORMATTED VARIABLES*************************************
-* Display formatted variables.
-TYPE Formatted variables:
-TYPE Start Date &START_YYMD, &START_YYMD_T, &START_MDYY
-TYPE End   Date &END_YYMD, &END_YYMD_T, &END_MDYY
-RUN

This message has been edited. Last edited by: reFOCUSing,
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
Silver Member
posted Hide Post
I changed my code since I am only trying to generate and enddate and this gives me what I needed. Thanks!

-SET &ENDDAY = EDIT(&ENDDATE,'$$$$$$99');
-SET &ENMNTH = EDIT(&ENDDATE,'$$$$99$$');
-SET &ENYEAR = EDIT(&ENDDATE,'9999$$$$');
-SET &ENDYEAR = &ENYEAR + 1;
-SET &NEWEND = &ENDYEAR||&ENMNTH||&ENDDAY;
-SET &END1 = &NEWEND;


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report 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     Formatting Parameter

Copyright © 1996-2020 Information Builders