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]Sorting within a field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Sorting within a field
 Login/Join
 
Member
posted
Hi

I'm trying to sort a field (APPN_YEAR) in Ascending order.

Objective is to get the data for the last 5 years; and APPN_YEAR is a dynamic field.


TABLE FILE BR_INV_HDR
SUM
BR_INV_HDR.BR_INV_HDR.INVOICE_AMT
BY HIGHEST 5 BR_INV_HDR.BR_INV_HDR.APPN_YEAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

Result looks as follows:
APPN_YEAR INVOICE_AMT
2017 93610332.14
2016 240328241.31
2015 226778167.30
2014 214523089.27
2013 214587383.42

However, I want the APPN_YEAR field to be sorted in ascending order.

Thank You

WebFocus App Studio - 8.1.05

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


Webfocus 8.1.05
 
Posts: 9 | Registered: November 14, 2013Report This Post
Expert
posted Hide Post
BY LOWEST 5...


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
Member
posted Hide Post
LOWEST 5 doesn't give me the desired output.

The data runs back in time and is displayed as follows:
APPN_YEAR INVOICE_AMT
1900 960626.70
2001 12287012.95
2002 91499635.79
2003 116905631.70
2004 128628263.04

I want to restrict the data to last 5 years only - starting from 2013 till 2017 as of now.

This year field is dynamic.


Webfocus 8.1.05
 
Posts: 9 | Registered: November 14, 2013Report This Post
Expert
posted Hide Post
I don't know what you mean by "This year field is dynamic". I can't think of a more elegant solution than a two-pass one - retrieve data to a hold file, then report off the hold file:

TABLE FILE BR_INV_HDR
SUM 
BR_INV_HDR.BR_INV_HDR.INVOICE_AMT
BY HIGHEST 5 BR_INV_HDR.BR_INV_HDR.APPN_YEAR

ON TABLE HOLD AS HOLD_BR_INV_HDR
END
-RUN

TABLE FILE HOLD_BR_INV_HDR
SUM 
BR_INV_HDR.BR_INV_HDR.INVOICE_AMT
BY BR_INV_HDR.BR_INV_HDR.APPN_YEAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
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
Virtuoso
posted Hide Post
You have two choices as I think of
1:
TABLE FILE BR_INV_HDR
SUM 
 BR_INV_HDR.BR_INV_HDR.INVOICE_AMT
BY HIGHEST 5 BR_INV_HDR.BR_INV_HDR.APPN_YEAR
ON TABLE HOLD AS TMP1 FORMAT FOCUS
END 
-RUN

TABLE FILE TMP1
SUM  INVOICE_AMT
BY APPN_YEAR
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
 INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END 


2:
-* Assuming that you receive a Year as a parameter since you mentioned that it's a dynamic field
-SET &LST5YRS = &RCVYR - 5;

TABLE FILE BR_INV_HDR
SUM 
 BR_INV_HDR.BR_INV_HDR.INVOICE_AMT
BY BR_INV_HDR.BR_INV_HDR.APPN_YEAR
WHERE BR_INV_HDR.BR_INV_HDR.APPN_YEAR GE &LST5YRS
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
 INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END 


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Report This Post
Member
posted Hide Post
Thank You Francis and Martin for the solution.

That's what I needed!


Webfocus 8.1.05
 
Posts: 9 | Registered: November 14, 2013Report 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]Sorting within a field

Copyright © 1996-2020 Information Builders