[CLOSED] How do I create a field that calculates current period activity?
I need to calculate the current period activity in Dollars.
I have two fields I can use to create this calculated field: 1. GRANT_PERIOD 2. SUM_YEAR_TO_DATE_ACTIVITY
The name of the calculated field will be: Current_Period_Activity
The user will enter one of the following parameters: 01 02 03 04 etc. through 12
I'm guessing I need to create a define. How do I write this so the output includes only activity in a single period?This message has been edited. Last edited by: Kerry,
November 29, 2012, 08:45 AM
George Patton
While in the shower I realised that I probably have misunderstood what you are trying to do...so here goes again.
Let's assume you have two database fields: GRANT_ACTIVITY and ACTIVITY_DATE in YYMD format
DEFINE FILE whatever
YEAR/YY = ACTIVITY_DATE;
GRANT_PERIOD/M = ACTIVITY_DATE;
END
TABLE FILE whatever
SUM GRANT_ACTIVITY
-* BY YEAR BY GRANT_PERIOD
WHERE YEAR EQ &YEAR AND GRANT_PERIOD EQ &GRANT_PERIOD
END
The comment line -* ... isn't necessary of course and won't produce any different result if GRANT_PERIOD EQ &GRANT_PERIOD, but would be useful if you wanted the year to date and changed the WHERE clause to: WHERE YEAR EQ &YEAR AND GRANT_PERIOD LE &GRANT_PERIOD
This assumes your date field is a SmartDate. You should also get the book "(Almost) 1001 ways to work with dates in WebFocus".This message has been edited. Last edited by: George Patton,
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
November 30, 2012, 10:25 AM
George Patton
But I do some of my best thinking in the shower ! (What you didn't see is that I posted a completely different solution earlier and then realised I had misunderstood the request).