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] Help using LAST command..

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Help using LAST command..
 Login/Join
 
Guru
posted
Hi,
here is the source
Year ID
1994 10
1994 12
1994 13
1995 11
1996 10
1996 13
1997 10
1997 14
1998 15
1998 16

The output I need is a count of IDs by year only one one condition that the ID's do not occur in the previous years..

year counts
1994 3
1995 1
1996 0
1997 1
1998 2


In other words for the year 1994 we account all IDs since thats the first year and 1995 we only count the ones that are newly added for that year and dont include any from the past and so on and so forth...

I tried to create a flag but not sure how to raise it using LAST command for my situation..
 
TABLE FILE MYFILE
PRINT ID COMPUTE CNTR/I5=IF ID NE LAST ID THEN 1 ELSE 0;
BY YR
END
 

Hope thismakes sense..pls let me know

This message has been edited. Last edited by: Kerry,
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Guru
posted Hide Post
Try this.

TABLE FILE MYFILE
SUM CNT.ID
BY YR
END


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Guru
posted Hide Post
Sorry if it seemed so simple...maybe I wasnt clear in explaining the problem...I need to count the IDs for each year making sure they are not accounted in the previous years already...please see my input/output...

Thanks for looking into this...
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Guru
posted Hide Post
Francis or Susanah

Please help!
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Guru
posted Hide Post
Does this give you what you need?

  
-* File prc_year_id.fex


FILEDEF YEAR_ID DISK year_id.txt
-RUN

-WRITE YEAR_ID 199410
-WRITE YEAR_ID 199412
-WRITE YEAR_ID 199413
-WRITE YEAR_ID 199511
-WRITE YEAR_ID 199610
-WRITE YEAR_ID 199613
-WRITE YEAR_ID 199710
-WRITE YEAR_ID 199714
-WRITE YEAR_ID 199815
-WRITE YEAR_ID 199816

FILEDEF MASTER DISK year_id.mas
-RUN

-WRITE MASTER FILENAME=YEAR_ID, SUFFIX=FIX
-WRITE MASTER DATASET=year_id.txt, $
-WRITE MASTER SEGNAME=YEAR_ID, SEGTYPE=S0, $
-WRITE MASTER FIELDNAME=YEAR, FORMAT=A4, ACTUAL=A4, $
-WRITE MASTER FIELDNAME=ID, FORMAT=A2, ACTUAL=A2, $
-RUN

TABLE FILE YEAR_ID
SUM
    YEAR
    ID
    COMPUTE CNTR/I8 =IF ID NE LAST ID THEN 1 ELSE 0;
BY ID NOPRINT
BY YEAR NOPRINT
ON TABLE HOLD AS H1
END

TABLE FILE H1
SUM
   YEAR AS 'Year'
   CNTR AS 'Counts'
BY YEAR NOPRINT
END
-EXIT


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
 
Posts: 320 | Location: Memphis, TN | Registered: February 12, 2008Report This Post
Guru
posted Hide Post
In that case try sorting the data by ID by YR.
TABLE FILE MYFILE
PRINT YR
BY ID
ON TABLE HOLD AS HOLDFILE
END
DEFINE FILE HOLDFILE
COUNTIT/I4=IF ID EQ LAST ID THEN 0 ELSE 1;
END
TABLE FILE HOLDFILE
SUM COUNTIT
BY YR
END


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Expert
posted Hide Post
Might Max's solution seems to work...


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
Thank you all...Let me work with it and see...
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report This Post
Guru
posted Hide Post
COUNTIT/I4=IF ID EQ LAST ID THEN 0 ELSE 1;
did the trick..although I tried it but did not check the results properly since there are few hundreds and only few get a flag..

Thanks again, Appreciate the help from all the FOCUSers
 
Posts: 289 | Location: Houston,TX | Registered: June 11, 2004Report 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] Help using LAST command..

Copyright © 1996-2020 Information Builders