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     [CLOSED] Determine MAX value within a DEFINE

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Determine MAX value within a DEFINE
 Login/Join
 
Member
posted
Is it possible to determine the max/highest value within a column ?


To determine max value normally we use:

TABLE FILE GWTBXXX
SUM
MAX.DAG_KEY
DST.DAG_KEY NOPRINT
ON TABLE HOLD AS HLDXXX FORMAT ALPHA
END
-RUN

To make use of a conditional join is not possible because the matrix is still missing.

We need max/highest value for selection within a Business View

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
 
Posts: 6 | Registered: April 13, 2016Report This Post
Virtuoso
posted Hide Post
Are you looking for BY HIGHEST 1 DAG_KEY?


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Expert
posted Hide Post
Assuming this request will go against a RDBMS, you could possibly use the function DB_EXPR.

DB_EXPR: Inserting an SQL Expression Into a Request


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
Member
posted Hide Post
Hi Was and BabakNCY,
By using masters we have acces to DB2-tables.

I've tried several options by using DB_EXPR, such as :

DEFINE FILE GWTBXXX
DAG_KEY/I11 WITH ID = DB_EXPR( SELECT MAX(DAG_KEY) FROM GWEGDBA.GWTBXXX ) ;
END

or

DEFINE FILE GWTBXXX
DAG_KEY/I11 WITH ID = DB_EXPR(SUM CNT.MAX(DAG_KEY) BY MAX.DAG_KEY AS DAG_KEY ;
END

and some more possibilities, but all results contains all possible dag_key's.

Till now I don't have 1 single DAG_KEY as output from the querie(s).


WebFOCUS 8
Windows, All Outputs
 
Posts: 6 | Registered: April 13, 2016Report This Post
Virtuoso
posted Hide Post
  
TABLE FILE GWTBXXX
BY HIGHEST 1 DAG_KEY
END


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Member
posted Hide Post
Using TABLE FILE in a BusinessView is not possible.
I do need a DEFINE FILE only.

SQL SQLDBM

SELECT MAX(DAG_KEY) AS DAG_KEY FROM GWEGDBA.GWTB263
;

-* Query below required to see the output

TABLE FILE SQLOUT
PRINT
DAG_KEY
ON TABLE HOLD AS MICHEL FORMAT ALPHA
END

TABLE FILE MICHEL
BY
DAG_KEY
ON TABLE PCHOLD AS TEMPHLD FORMAT HTML
END
-RUN
;
-EXIT

Unfortunately using:
DAG_KEY/I11 WITH ID = DB_EXPR( SELECT MAX(DAG_KEY) AS DAG_KEY FROM GWEGDBA.GWTB263 ) ;

give me not the result I was hoping for… :-(


WebFOCUS 8
Windows, All Outputs
 
Posts: 6 | Registered: April 13, 2016Report This Post
Expert
posted Hide Post
You could use the MIN and MAX functions based on 'THIS' and 'LAST' records for a given field. I've done this and it works fine.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
What did you want to do with the DAG_KEY ?


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
Member
posted Hide Post
Unfortunaltely, it doesn't work.

I thinks that a specific setting is required for using DB_EXPR on the server.


WebFOCUS 8
Windows, All Outputs
 
Posts: 6 | Registered: April 13, 2016Report This Post
Member
posted Hide Post
To determine the information represent the right day.


WebFOCUS 8
Windows, All Outputs
 
Posts: 6 | Registered: April 13, 2016Report This Post
Guru
posted Hide Post
Why not first retrieve DAY_KEY and read it into a param:

 
SQL SQLDBM

SELECT MAX(DAG_KEY) AS DAG_KEY FROM GWEGDBA.GWTB263
;

-* Query below required to see the output

TABLE FILE SQLOUT
PRINT
DAG_KEY
ON TABLE HOLD AS MICHEL FORMAT TAB
END
-RUN
-READFILE MICHEL 
-TYPE &DAG_KEY
 


After that you have some other TABLE request with join and you just use ... EQ &DAG_KEY instead of using a field.


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report This Post
Member
posted Hide Post
Hi Frans,
There is no possibility to use TABLE FILE within a BusinessView.
A DEFINE is the only way.

I'm a step further:
DEFINE FILE GWTB263
MAX_DAG_KEY/I11 WITH DAG_KEY = DB_EXPR(SELECT MAX(DAG_KEY) FROM GWEGDBA.GWTB263 ) ;
END


WebFOCUS 8
Windows, All Outputs
 
Posts: 6 | Registered: April 13, 2016Report This Post
Guru
posted Hide Post
You can use a masterfile profile and do the TABLE FILE there and use a global (&&) parameter


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
 
Posts: 454 | Location: Europe | Registered: February 05, 2007Report 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     [CLOSED] Determine MAX value within a DEFINE

Copyright © 1996-2020 Information Builders