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] Dynamic Sort Columns

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Dynamic Sort Columns
 Login/Join
 
Member
posted
I want to be able to give my users the option to select their sort columns at runtime.
I want to have a dropdown list with two options(Region and Country). If the user selects Region the report should sort by Region and then by Country. If she selects Country then the sort should be by Country then by Region.

I've looked at other posts on this forum using the search phrase "dynamic column sorting" but everything I found was about sorting the same column from lowest to highest and vice/versa using a hyperlink.

Can anyone help with this?

This message has been edited. Last edited by: Michael Watts,


8.0.03/Windows7
 
Posts: 13 | Registered: July 02, 2014Report This Post
Master
posted Hide Post
Hi,

You can achieve this using dialog manager commands. Below example shows sorting BY COUNTY and BY CAR based on user selection.

TABLE FILE CAR
PRINT
SALES
DEALER_COST
-IF &USER_SELECTION EQ 'COUNTRY' THEN GOTO L_SRT_CNTY ELSE GOTO L_SRT_CAR;
-L_SRT_CNTY
BY COUNTRY
BY CAR
-GOTO L_SRT_END;
-L_SRT_CAR
BY CAR
BY COUNTRY
-L_SRT_END
END


Hope this helps.

Thanks,
Ram
 
Posts: 542 | Location: Dearborn, MI | Registered: June 03, 2009Report This Post
Virtuoso
posted Hide Post
You can use parameter promoting for fields, including sorting:
.
BY  &Sort.(<COUNTRY,COUNTRY>,<CAR,CAR>,<None,_FOC_NULL>).Please select sort field.
.

This can be used by both parameter promoting and recognised in HTML composer.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
You can also use this way to avoid the DM command in the TABLE FILE ... END part:
-* EITHER WAY USING IF OR DECODE WORKS, DECODE TAKES LESS CODE
-*-SET &BY1 = IF &USER_SELECTION EQ 'COUNTRY' THEN 'COUNTRY' ELSE IF &USER_SELECTION EQ 'CAR' THEN 'CAR'     ELSE 'MODEL';
-*-SET &BY2 = IF &USER_SELECTION EQ 'COUNTRY' THEN 'CAR'     ELSE IF &USER_SELECTION EQ 'CAR' THEN 'COUNTRY' ELSE BODYTYPE';

-SET &BY1 = DECODE &USER_SELECTION ('COUNTRY' 'COUNTRY' 'CAR' 'CAR'     ELSE 'MODEL');
-SET &BY2 = DECODE &USER_SELECTION ('COUNTRY' 'CAR'     'CAR' 'COUNTRY' ELSE 'BODYTYPE');

TABLE FILE CAR
PRINT SALES
      DEALER_COST
BY &BY1
BY &BY2
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
Platinum Member
posted Hide Post
My example is close to Martin's example. Mine assumes you have an HTML page which contains your selection dropdown box. The value selected from the drop down will be passed into your fex as an &VAR. In my example I'm setting '&SORT' since I don't have an HTML page in my example:

 
-SET &SORT = 'CAR';
-SET &SORT2 = IF &SORT EQ 'COUNTRY' THEN 'CAR' ELSE 'COUNTRY';

TABLE FILE CAR
PRINT MODEL
	  SEATS
BY &SORT.EVAL
BY &SORT2.EVAL
END
-EXIT
 


WF 7.7.05
HP-UX - Reporting Server, Windows 2008 - Client, MSSQL 2008, FOCUS Databases, Flat Files
HTML, Excel, PDF
 
Posts: 149 | Location: Dallas, TX | Registered: June 08, 2007Report This Post
Master
posted Hide Post
Or you could do it like this:

-SET &SORTLIST = IF &USER_SELECTION EQ 'COUNTRY' THEN 'BY COUNTRY BY CAR' ELSE 'BY CAR BY COUNTRY';

TABLE FILE CAR
PRINT 
SALES
DEALER_COST
&SORTLIST
END

Note, however,that if you open this in the DevStudio GUI editor it will complain about the &SORTLIST inside the table. However it runs just fine.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report 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] Dynamic Sort Columns

Copyright © 1996-2020 Information Builders