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     [CLOSED] Past 26 periods

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Past 26 periods
 Login/Join
 
Guru
posted
Thanks in advance for help. I have looked into previouse weeks calculations, and I also have searched for a solution here on focal point. Maybe I am missing something. Last time I posted, someone was just upset telling me where the search option was.
Anyways:
I am trying to write a report where report needs to calculate previouse 26 periods. 26 periods EQ to 52 weeks from the date. How do I get data that is > previouse 52 weesk date? I tried
/Code
TODAYS/YYMD = &YYMD;
YESTERDAY/YYMD = TODAYS - 360;
/
But it doesnt work.

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


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Expert
posted Hide Post
Here is the search option. http://ecl.informationbuilders.com/ecl/search, Smiler

I searched for week number, and found this.

SET WEEKFIRST=1
DEFINE FILE EMPDATA
  DATEL/A8YYMD= HIREDATE;
  DATEM/A17 = DATEL | '000000000';
  DATEJ/HYYMDS = HINPUT(17,DATEM, 8, 'HYYMDS');
  WEEK_COMPONENT/A10 = HNAME(DATEJ, 'WEEK', 'A10');
END
TABLE FILE EMPDATA
  PRINT    HIREDATE
           DATEL
           DATEM
           DATEJ
           WEEK_COMPONENT
END


Hope it helps


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
Expert
posted Hide Post
You would like to manipulate dates, how about reading up on Date and Date-Time functions? Functions Reference

To use dates with Dialogue Manager (which can then be used as filter values), you must use the DATECVT function to convert a string to a Date to manipulate it, then use DATECVT to convert it back to a string. e.g.:

-SET &TODAYS = '20000216';

-SET &YESTERDAYS = DATECVT( DATEADD(DATECVT(&TODAYS,'I8YYMD','YYMD'),'D', -365), 'YYMD','I8YYMD');

TABLE FILE CENTORD
SUM
QUANTITY
BY STATE
BY STORENAME
BY ORDER_DATE
WHERE ORDER_DATE FROM &YESTERDAYS TO &TODAYS   
END


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 following piece of code takes a certain date (which could be dynamic but in this example is fixed date), finds out what the end of the previous week is (which will become the end date), sets the start date to 52 weeks before, calculates the difference between the database date and the startdate and calculates a period (which is probably not correct but you may not even be interested in that):
DEFINE FILE DATABASE
NOW/YYMD WITH DB_DATE = 20090214;
WD/W         = NOW;
X/I4         = WD;
ENDD/YYMD    = NOW - X;
STTD/YYMD    = ENDD - 52*7;
DIFFER/I4    = DB_DATE - STTD;
PERIO/I4     = (DIFFER / 14) + 1;
END

TABLE FILE DATABASE
PRINT DB_DATE NOW WD STTD ENDD DIFFER PERIO
WHERE DB_DATE LT ENDD;
WHERE DB_DATE GT STTD;
END

Hope this helps a bit...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
When I try this code
Code /
SET WEEKFIRST=1
DEFINE FILE AGG_ENROLLMENT
DATEL/A8YYMD= HIREDATE;
DATEM/A17 = DATEL | '000000000';
DATEJ/HYYMDS = HINPUT(17,DATEM, 8, 'HYYMDS');
WEEK_COMPONENT/A10 = HNAME(DATEJ, 'WEEK', 'A10');
END
/
I get the following Error
/ 0 ERROR AT OR NEAR LINE 12 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: HIREDATE
0 ERROR AT OR NEAR LINE 13 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: DATEL
0 ERROR AT OR NEAR LINE 14 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: DATEM
0 ERROR AT OR NEAR LINE 15 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: DATEJ
/

When I try this code/DEFINE FILE AGG_ENROLLMENT

NOW/YYMD WITH DB_DATE = 20090214;
WD/W = NOW;
X/I4 = WD;
ENDD/YYMD = NOW - X;
STTD/YYMD = ENDD - 52*7;
DIFFER/I4 = DB_DATE - STTD;
PERIO/I4 = (DIFFER / 14) + 1;
END
/
I get the following Error/
0 ERROR AT OR NEAR LINE 11 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: DB_DATE
0 ERROR AT OR NEAR LINE 12 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: NOW
0 ERROR AT OR NEAR LINE 13 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: WD
0 ERROR AT OR NEAR LINE 14 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: NOW
0 ERROR AT OR NEAR LINE 15 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: ENDD
0 ERROR AT OR NEAR LINE 16 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: DB_DATE
0 ERROR AT OR NEAR LINE 17 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: DIFFER
/


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Virtuoso
posted Hide Post
quote:
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: HIREDATE

Arif, HIREDATE is just a field if the EMPDATA sample table provided with WebFOCUS and that was used by Waz to illustrate the concept. You must adjust the code to make use of your own tables and fields as they exits in your environment. The other errors you obtained are likely just in cascade due to the initial one.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Platinum Member
posted Hide Post
Bonjour,
Date Formats, what a shock it was when it first appeared, around 90's (I'd say before 1990...)
IB's guys helped me, then : It's simple Claude : All the day Formats are, in the inside the number of days since an origin ( 01/01/1900 ? 01/01/19001 ? not very important)
The Month Format being a number of Month since that same Origin.
If you want to make complex Translation between those 'new' Date Formats, Just Code an affectation : Focus Knows, and he will do it right - Don't forget that an Affectation of a Month Format in a Day Format will give you the First Day of the Month.
If you add or Subtract Numbers to a Date Format, it will Add or Subtract Days if Day Format, Month if Month Format.

The Big Point is Turning Non-Date Formats into Date Formats : Tell Focus, you want Him to translate :
 AUJOURD_HUI/DMYY WITH field = '18-05-2010' ;  Rather than [CODE] AUJOURD_HUI/DMYY WITH field = 18052010 ;  -* He might think you already know the Number of Days and do not translate 

Always Remember that a Date Format is Ambiguous, it's Chararacter since When you SUM DATE, you get LST.DATE and it's numeric since, actually, it's a number of Days ( - 1 and you get Yesterday ...)
And I never forgot what the gurus of the time taught me. I use DATECVT from time to time.
But I'll probably never write
 DATECVT( DATEADD(DATECVT(&TODAYS,'I8YYMD','YYMD'),'D', -365), 'YYMD','I8YYMD');
 
which is ugly and Focus code should be more obvious than this ( Francis, I know that you are, now, a better Focus Guy than I )
But I know that my wish you master Focus because you know his dirty tricks and have touched his very soul is nothing but an old timer's dream. What you like is efficiency and what I like is singing a strange Focusian Blues.
(Ole Man River, and if he drinks a little scotch ...)
Focusely and Cordially


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
 
Posts: 134 | Registered: November 06, 2007Report This Post
Platinum Member
posted Hide Post
Oh, I Forget : The remainder of the division of a Day Format by 7 gives you the Day of the week ...
But You'll find Great Builtins that will Hide you that with great efficiency.
Time, Time, Time is on your side, yes it is
Cordially and Focusely


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
 
Posts: 134 | Registered: November 06, 2007Report This Post
Expert
posted Hide Post
Arif, error messages FOC003 and FOC258 are very clear: you are referencing fields that do not exist in the table. I'm pretty sure that HIREDATE does not exist in table AGG_ENROLLMENT, but I'm certain it exists in table EMPDATA. Only you can tell us if DB_DATE exists in AGG_ENROLLMENT.

If you need to filter the data based on these two values, I would suggest NOT defining the fields, but rather creating two Dialogue Manager fields that you would use in a WHERE statement.


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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Past 26 periods

Copyright © 1996-2020 Information Builders