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] Working with fst and lst

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Working with fst and lst
 Login/Join
 
Gold member
posted
Hi!

I have the following:

FDL1 FLD2 FLD3
0000016 15 20070906093622884675
0000016 16 20070906093951119932
0000016 17 20070906122539314423
0000016 18 20070907105723166300
0000016 20 20070907124338695694
0000016 24 20070911100301263031

FLD3 is an alphanumeric timestamp, and I would like to know, in days, time between each change of FLD2.

So, the first record, should be 0 since is the first record. Second one, should be the current timestamp of record2 - the last timestamp (Record 1), because FLD2 has changed, and so on.

Need advices how to achieve this, it seems I can't achieve exactly what I'm looking for.

Best regards for the help Smiler

This message has been edited. Last edited by: <Kathryn Henning>,
 
Posts: 52 | Location: Madrid | Registered: July 18, 2005Report This Post
Virtuoso
posted Hide Post
To get a meaningful difference between those timestamps, you will need to convert them to an actual date format.

For example:
DEFINE FILE TBL
  TIMESTAMP/HYYMDs = HINPUT(20, FLD3, 8, TIMESTAMP);
END
TABLE FILE TBL
SUM
  COMPUTE DIFF/I5 = HDIFF(FST.TIMESTAMP, LAST FST.TIMESTAMP, 'DAY', DIFF);

BY FLD1
BY FLD2
END


This gets you the differences between the timestamps of each first instance of FLD2. Which timestamp per FLD2 that is is undefined, as there is no ordering on FLD3 - you cannot add that or you lose the grouping.

Another option is to weed out the timestamps that you don't desire to calculate the difference between first:
TABLE FILE TBL
SUM
  FST.TIMESTAMP

BY FLD1
BY FLD2
BY LOWEST 1 FLD3
ON TABLE HOLD
END
-RUN

TABLE FILE HOLD
SUM
  COMPUTE DIFF/I5 = HDIFF(TIMESTAMP, LAST TIMESTAMP, 'DAY', DIFF);

BY FLD1
BY FLD2
END


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Master
posted Hide Post
The one suggestion I would add to what Wep5622 says is to use MINUTE or SECOND instead of DAY in the HDIFF function. I have requested a NFR, but HDIFF does not return fractions of days, so if the difference was 23 hours and 59 minutes, your return would be 0.

If you use MINUTE, divide the result by 1440 minutes/day to get fractions of days.
If you use SECOND, divide the result by 34560 seconds/day to get fractions of days.

Obviously if you do this, then DIFF is a F, D or P format (i.e. D12.2).

My NFR is for HDIFF to return fractions of the time unit (YEAR, DAY, MINUTE, etc.) when a F, D or P format is used.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 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     [CLOSED] Working with fst and lst

Copyright © 1996-2020 Information Builders