Focal Point
get MAX of a DATE field into the HEADER ??

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9631085062

December 06, 2007, 11:06 PM
susannah
get MAX of a DATE field into the HEADER ??
anybody know how to get the MAX of a DATE/yymd field into a header?
i tried  <MAX.DATE ...nada
i tried <LST.DATE ... nada
i tried <TOT.DATE ... zippo
i tried <MAX. DATE  ... nada [with that funny blank you sometimes need for stuff)

argh!!!




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 07, 2007, 02:14 AM
Piipster
This seemed to work for me:

TABLE FILE EMPDATA
HEADING
"The last employee was hired on: <MAX.HIREDATE> </1"
SUM MAX.HIREDATE NOPRINT
PRINT HIREDATE
BY HIREDATE NOPRINT
  BY PIN
END
  



ttfn, kp


Access to most releases from R52x, on multiple platforms.
December 07, 2007, 02:30 AM
Tony A
Karen,

You don't say what release you used although I guess it was as per Susannah's signature. I'm not sure that it matters anyway as the code you give is what I would normally do for this anyway!

Susannah,

The important bit of code is, as Karen has, is the SUM MAX.datefield NOPRINT before your next verb object such that is obtains the max date field value at TABLE level which is what you require.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 07, 2007, 03:40 AM
susannah
i tried that, melbourne, didn't work.
i got nada




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 07, 2007, 03:41 AM
susannah
i did that.
i got nada
i'm in 764.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 07, 2007, 04:25 AM
FrankDutch
Susannah

how about putting the max date in an amper




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

December 07, 2007, 07:42 AM
Tom Flynn
Hi Susannah,

This may help:

TABLE FILE WHATEVER
SUM
MAX.DATE
ON TABLE SAVE AS MAX_DATE
END
-RUN
-READ MAX_DATE &MAX_DATE.A8.

then use &MAX_DATE in the HEADING

Hope this helps...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
December 07, 2007, 08:38 AM
FrankDutch
very good Tom Big Grin




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

December 07, 2007, 08:45 AM
jgelona
Susannah, what Piipster suggested works fine in 7.13. Could this be a bug?


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
December 07, 2007, 08:51 AM
GinnyJakes
Works in 762 as well.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
December 07, 2007, 02:25 PM
Tom Flynn
quote:
TABLE FILE EMPDATA
HEADING
"The last employee was hired on: SUM MAX.HIREDATE NOPRINT
PRINT HIREDATE
BY HIREDATE NOPRINT
BY PIN
END


Actually, works fine in 7.6.4 as well...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
December 07, 2007, 02:52 PM
susannah
yes melbourne's ex works fine in 764 as well. Tom, yes but im trying to avoid the double data pass.
so that confirms the prob is in my sleep-deprived brain.
merci, mes amis.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 07, 2007, 03:55 PM
Tom Flynn
quote:

but im trying to avoid the double data pass.


Ahhhhhh, a little tid-bit left unmentioned!!!

Doing the -READ is really very quick, especially, if the column is indexed, as I know, that, you know....

Have a great weekend...

P.S. Stop getiing up at 3:30 in the morning!!!!


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
December 09, 2007, 02:24 AM
susannah
aha.
this works
TABLE FILE EMPDATA
HEADING
"min hire date <MIN.HIREDATE  TO max <MAX.HIREDATE> </1"
SUM MAX.HIREDATE NOPRINT
SUM  
-*CNT.DST.PIN
SALARY BY DEPT
END

but this doesn't
TABLE FILE EMPDATA
HEADING
"min hire date <MIN.HIREDATE  TO max <MAX.HIREDATE> </1"
SUM MAX.HIREDATE NOPRINT
SUM   
CNT.DST.PIN  
SALARY BY DEPT
END

Its the count distinct that blows it slam out of the water. rats. its 2pass time.
you don't even need the first SUM
Is this a bug or a feature?

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 09, 2007, 10:38 PM
Piipster
Yes, Tony, unless I say otherwise I use the version and OS specified in the thread.

For example for my next version of this code I used WF R714 on Windows 2003 EE.

Renaming the MAX.datefield and putting the HEADING at the bottom seems to work with one pass:

TABLE FILE EMPDATA
SUM 
MIN.HIREDATE NOPRINT
COMPUTE MIN_DATE/YMD = MIN.HIREDATE; NOPRINT
MAX.HIREDATE NOPRINT
COMPUTE MAX_DATE/YMD = MAX.HIREDATE; NOPRINT
SUM   
CNT.DST.PIN  
SALARY BY DEPT
HEADING
"Date of most recent employee hire: <MAX_DATE "
"First employee hired on: <MIN_DATE </1"
END




ttfn, kp


Access to most releases from R52x, on multiple platforms.
December 09, 2007, 11:42 PM
susannah
Thank you ,Melbourne!




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
December 10, 2007, 03:17 AM
Tony A
Karen,

I guessed that was the case, I was just ensuring the readers would realise that before jumping headlong in etc......

As for the sequence of code, who would have though that it would make that much difference Confused So much for coding free of sequence requirements Frowner

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 10, 2007, 09:26 AM
cburtt
Hi Suusannah,

I've never seen the use of multple SUM or PRINT verbs with a single END as illustrated in this post. Isn't the first SUM a "dangling SUM" in that it has no matching END? I think of SUM-END/PRINT-END like parenthesis that must be in matched pairs and am curious about the operation of such multiple 'openings' with only one 'closing'.

Chris


WIN/2K running WF 7.6.4
Development via DevStudio 7.6.4, MRE, TextEditor.
Data is Oracle, MS-SQL.
December 10, 2007, 09:43 AM
GinnyJakes
Chris,

This is called a 'multi-verb' request and has been around forever. The major caveat is that the BYs be nested, i.e. either the same or every increasing. The last verb can be a PRINT.

A very useful tool.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
December 10, 2007, 10:01 AM
Tony A
To supplement Ginny's excellent explanation, you can also have something like
TABLE FILE yourfile
SUM fieldname
PRINT fieldname
etc. ...
(e.g. without a sort phrase between) to provide a summated value at the top level.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 10, 2007, 02:36 PM
susannah
Chris...oh you've just stumbled upon *the* coolest thing about wf, double verbs, triple verbs..howevermayyouwant verbs..all to create aggregates at whatever level you need.
and 1 end statement.
Now that you've discovered that, you'll never get any more sleep Wink

T, i did know about the HEADING at the end bit... i learned that one SUMMIT, probably from Renee or Noreen...just a flying one-liner that stuck in my head...ah the value of SUMMIT..
its that COMPUTE to actually get past the CNT.DST aggregation that may not ever have occured to me without the POINT here. And the fact that Melbourne is up earlier than the rest of us. thanks again, downunder.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID