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] Operating with a rusty brain! Need help with YTD accumulation

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Operating with a rusty brain! Need help with YTD accumulation
 Login/Join
 
Expert
posted
I'm just back on the wagon and my brain is rusty.

I'm trying to create a YTD field in a HOLD file and I just can't figure it out. It's got to be simple, but it's been six weeks since I had one thought about WebFOCUS.

This is my test fex:

-SET &ECHO=ALL;

SET BYDISPLAY=ON
SET HOLDFORMAT=ALPHA
SET HOLDLIST=PRINTONLY
-RUN

-*-- Create the master for TEST -------------------------
APP FI DATAMAST DISK test.mas
-RUN

-WRITE DATAMAST FILE=TEST, SUFFIX=FIX, $
-WRITE DATAMAST SEGNAME=SEG1, SEGTYPE=S0, $
-WRITE DATAMAST   FIELD=DATE1   , ALIAS=E01, USAGE=YYMD, ACTUAL=A08, $
-WRITE DATAMAST   FIELD=        , ALIAS=E02, USAGE=A01 , ACTUAL=A01, $
-WRITE DATAMAST   FIELD=AMT     , ALIAS=E03, USAGE=I02 , ACTUAL=A02, $

-*-- Create the data file for TEST ----------------------
FILEDEF TEST DISK test.ftm
-RUN

-WRITE TEST 20101221 15
-WRITE TEST 20101222 05
-WRITE TEST 20101223 20
-WRITE TEST 20101224 35
-WRITE TEST 20101225 15

-WRITE TEST 20110101 10
-WRITE TEST 20110102 20
-WRITE TEST 20110103 10
-WRITE TEST 20110104 05
-WRITE TEST 20110105 10

DEFINE FILE TEST
DATE1_BEG/YYMD = DATEMOV(DATE1, 'BOY');
AMT_YTD/D6 = 0;
END
-RUN

TABLE FILE TEST
SUM 
AMT_YTD
BY DATE1_BEG NOPRINT

PRINT
AMT

BY DATE1_BEG NOPRINT
BY DATE1
END
-RUN

What I'd like to get is the following:
DATE1    AMT AMT_YTD
-------- --- -------
20101221  15      15
20101222  05      20
20101223  20      40
20101224  35      75
20101225  15      90
20110101  10      10
20110102  20      30
20110103  10      40
20110104  05      45
20110105  10      55

I am missing something essential.

Thanks,

This message has been edited. Last edited by: Francis Mariani,


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
A little hint....

Try LAST in a calc.

Music


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
thanks!!!

-SET &ECHO=ALL;

SET BYDISPLAY=ON
SET HOLDFORMAT=ALPHA
SET HOLDLIST=PRINTONLY
-RUN

-*-- Create the master for TEST -------------------------
APP FI DATAMAST DISK test.mas
-RUN

-WRITE DATAMAST FILE=TEST, SUFFIX=FIX, $
-WRITE DATAMAST SEGNAME=SEG1, SEGTYPE=S0, $
-WRITE DATAMAST   FIELD=DATE1   , ALIAS=E01, USAGE=YYMD, ACTUAL=A08, $
-WRITE DATAMAST   FIELD=        , ALIAS=E02, USAGE=A01 , ACTUAL=A01, $
-WRITE DATAMAST   FIELD=AMT     , ALIAS=E03, USAGE=I02 , ACTUAL=A02, $

-*-- Create the data file for TEST ----------------------
FILEDEF TEST DISK test.ftm
-RUN

-WRITE TEST 20101221 15
-WRITE TEST 20101222 05
-WRITE TEST 20101223 20
-WRITE TEST 20101224 35
-WRITE TEST 20101225 15

-WRITE TEST 20110101 10
-WRITE TEST 20110102 20
-WRITE TEST 20110103 10
-WRITE TEST 20110104 05
-WRITE TEST 20110105 10

DEFINE FILE TEST
DATE1_BOY/YYMD = DATEMOV(DATE1, 'BOY');
AMT_YTD1/D13 = IF DATE1_BOY EQ LAST DATE1_BOY THEN AMT + LAST AMT_YTD1 ELSE AMT;
END
-RUN

TABLE FILE TEST
PRINT
DATE1_BOY

AMT
AMT_YTD

BY DATE1

ON TABLE HOLD AS H001
END
-RUN

TABLE FILE H001
PRINT *
END
-RUN

My brain is slowly leaving the station!


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
Stoke that coal....



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
<JJI>
posted
Francis,

Here is another possible solution without a hold file.
DEFINE FILE TEST
DATE1_BEG/YYMD = DATEMOV(DATE1, 'BOY');
AMT_YTD/D6 = 0;
END
-RUN

TABLE FILE TEST
SUM
 AMT
COMPUTE CMP_AMT_YTD/D9  = IF DATE1_BEG EQ LAST DATE1_BEG THEN LAST CMP_AMT_YTD + AMT ELSE AMT;
BY DATE1_BEG NOPRINT
BY DATE1
END
-RUN

This message has been edited. Last edited by: <JJI>,
 
Report 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] Operating with a rusty brain! Need help with YTD accumulation

Copyright © 1996-2020 Information Builders