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] Max value related column

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Max value related column
 Login/Join
 
Platinum Member
posted
Hello,
I'm new into webFOCUS and this is my first, of I hoe many, posts.

My scenario is:

Data: entity, time, value
I want to select the max value grouped by entity and get the time of the max value.

Example:
entity, time, value
A, 2010, 20
A, 2011, 30
B, 2010, 10
B, 2011, 5
C, 2010, 10

Expected output:
entity, time, value
A, 2011, 3
B, 2010, 10
C, 2010, 10

Thanks,
Carlos Dias

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


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
 
Posts: 127 | Location: Aveiro, Portugal | Registered: February 04, 2011Report This Post
Platinum Member
posted Hide Post
TABLE FILE xxx
BY entity
BY time
BY HIGHEST value
END

Christian


WF Production Version: 7.7.02M
WF Test Version: 7.7.02M
Developer Studio: 7.7.02
HTML, EXL2K, FLEX, PDF,PPT
 
Posts: 156 | Location: Essen Germany | Registered: December 02, 2010Report This Post
Virtuoso
posted Hide Post
So close ...
If you want just one record with the highest value it is: BY HIGHEST 1 VALUE.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Platinum Member
posted Hide Post
Thanks for the answers. But unfortunately doesn't work.

What I get is (example) in HTML:
A, 2010, 20
2011, 30
B, 2010, 10
2011, 5
C, 2010, 10

Not as expected...
Using the max.value by entity I get the right order. But I can't find a way of getting the time where the value is max.


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
 
Posts: 127 | Location: Aveiro, Portugal | Registered: February 04, 2011Report This Post
Virtuoso
posted Hide Post
this would do it


-* File byhighest.fex
FILEDEF MAS_A DISK file_a.mas
FILEDEF FILE_A DISK file_a.ftm

-RUN
-WRITE MAS_A FILENAME=FILE_A, SUFFIX=FIX, $
-WRITE MAS_A SEGNAME=FILE_A, $
-WRITE MAS_A FIELDNAME=ENTITY, FORMAT=A1, ACTUAL=A1, $
-WRITE MAS_A FIELDNAME=TIME, FORMAT=I4, ACTUAL=A4, $
-WRITE MAS_A FIELDNAME=VALUE1, FORMAT=D5, ACTUAL=A2, $
-WRITE FILE_A A201020
-WRITE FILE_A A201130
-WRITE FILE_A B201010
-WRITE FILE_A B20115
-WRITE FILE_A C201010
-RUN

TABLE FILE FILE_A
BY ENTITY
BY HIGHEST 1 VALUE1
BY TIME
END


The sequence of the BY fields is important

you want only 1 highest value by one entity




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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Platinum Member
posted Hide Post
Thanks for the answer Frank.
But my problem is that I want to show the results in this order entity, time, value.


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
 
Posts: 127 | Location: Aveiro, Portugal | Registered: February 04, 2011Report This Post
Expert
posted Hide Post
You have some work to do: read the manual.

-* File fpcarlos1.fex

-SET &ECHO='ALL';

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

FILEDEF FILE1 DISK file1.txt
-RUN

-WRITE FILE1 A 2010 20
-WRITE FILE1 A 2011 30
-WRITE FILE1 B 2010 10
-WRITE FILE1 B 2011 05 
-WRITE FILE1 C 2010 10

FILEDEF MASTER DISK file1.mas
-RUN

-WRITE MASTER FILENAME=FILE1, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=FILE1, $
-WRITE MASTER FIELDNAME=ENTITY, FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=FILL1,  FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=TIME,   FORMAT=I4, ACTUAL=A4, $
-WRITE MASTER FIELDNAME=FILL2,  FORMAT=A1, ACTUAL=A1, $
-WRITE MASTER FIELDNAME=VALUEA, FORMAT=I2, ACTUAL=A2, $
-RUN

TABLE FILE FILE1
PRINT
ENTITY
TIME
VALUEA
BY ENTITY NOPRINT
BY HIGHEST 1 VALUEA NOPRINT
END
-RUN


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
Platinum Member
posted Hide Post
Thanks Francis


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
 
Posts: 127 | Location: Aveiro, Portugal | Registered: February 04, 2011Report 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] Max value related column

Copyright © 1996-2020 Information Builders