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] Sort amper values

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Closed] Sort amper values
 Login/Join
 
Guru
posted
I am getting a list of values from an amper variable (for example: France,England,Germany). I would like to display this list in my heading but sorted in ascending alphabetical order. Should I do a TABLE request off of this list? If so, how can I turn the amper into a data source? If not, are there better ways of doing this (assuming that I can not necessarily receive the list sorted).

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


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
 
Posts: 256 | Registered: July 21, 2008Report This Post
Expert
posted Hide Post
There a probably dozens of ways to do this. You could write them to a temp file, use a generic master filedef'd to this file to sort them and write another file. You can then do a repeat loop to read them into indexed variables which you can use in your heading.

I'm sure you will get more ideas.


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
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Expert
posted Hide Post
I think Ginny's suggestion is the easiest and simplest way. There are examples in this forum of writing stuff to a temp file and writing out temp masters, and reading from a file.


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
Guru
posted Hide Post
Thanks.


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
 
Posts: 256 | Registered: July 21, 2008Report This Post
Expert
posted Hide Post
As you are running windows you could do as Ginny suggests but instead of creating a generic MFD you could just issue a DOS command via the SYSTEM function to perform a DOS SORT on the temp file, then read it back in. Just as easy and could be adapted to any platform.

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Guru
posted Hide Post
Thanks, I will give it a shot.


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
 
Posts: 256 | Registered: July 21, 2008Report This Post
Master
posted Hide Post
Hi Tony,

I have tried your way but didn't get it proper. I am sure I am missing something. Please check the following code

-DEFAULT &TESTVAR='England, Italy';



DOS SET > c:\kamesh\temp.txt
-RUN

FILEDEF SETTINGS DISK c:\kamesh\temp.txt
-RUN

? HOLD SETTINGS
- TYPE BEFORE PROCESS

-WRITE SETTINGS &TESTVAR
-CLOSE SETTINGS

DOS SORT c:\kamesh\temp.txt

-TYPE &TESTVAR AFTER SORTED
-EXIT


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Expert
posted Hide Post
That's because there's only one row in the file being sorted by the DOS SORT command.


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
Master
posted Hide Post
Francis, you are right? That works after I made it to 2 lines.

The key is to write the separated values in to temp file by row wise.


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Virtuoso
posted Hide Post
If all the values are separated by a
comma space
sequence, the following WF code will convert the one-line list into separate lines and sorting them (on Windows):
-SET &TEXT1='France, England, Germany';
-SET &CRLF= HEXBYT(13,'A1') | HEXBYT(10,'A1') ; 
-SET &TEXT2=STRREP( &TEXT1.LENGTH, &TEXT1, 2, ', ', 2, &CRLF, &TEXT1.LENGTH, 'A&TEXT1.LENGTH' );
FILEDEF TEXT2 DISK .\TEXT2.DAT
-RUN
-WRITE TEXT2 &TEXT2
-RUN
-DOS SORT TEXT2.DAT > TEXT3.DAT

-DOS TYPE TEXT2.DAT
-DOS TYPE TEXT3.DAT


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
Keep in mind that some installations may have OS commands turned off.

In this case use Ginny's suggestion


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
Expert
posted Hide Post
But you still have to have the values on separate lines. I didn't state that in my first post as I thought it was obvious. So do the first part of Waz' post then the TABLE with the default master. Or make a special master specific to the solution.


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
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
<JG>
posted
You could always stick into an array and sort it via JavaScript before
sending it to WebFOCUS
 
Report This Post
Guru
posted Hide Post
JG -

Yes, that would, in a sense, be the easiest solution.

However, I didn't want to necessarily rely on the front end to do the sorting. 1. Front ends aren't always built by the same team as the back ends and we can't always dictate to them what to do. 2. What if a new front end is built one day - do they know that they have to sort the data? Relying on the front end means that forever more, any front end that is built against your report will necessary conform to your rules. If possible, I'd rather have my reports do the work that they deem as necessary rather than rely on those calling my reports to do the work for me.


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
 
Posts: 256 | Registered: July 21, 2008Report This Post
Master
posted Hide Post
When we retrieve the values from the saved file, we have to be careful with the length of the text.

-DEFAULT &TESTVAR='UnitedStates, India, Germany, England, Italy';

In the above variable all the values are not on same length.

-SET &TT=' ';
-NEXTVAL
-READ TEXT3 &TT
-IF &IORETURN EQ 1 THEN GOTO ENDREAD ELSE GOTO CONTREAD;
-CONTREAD
-TYPE VALUES &TT
-GOTO NEXTVAL;
-ENDREAD

May be I am missing something here,


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report This Post
Master
posted Hide Post
Full code:

-DEFAULT &TESTVAR='UnitedStates, India, Germany, England, Italy';

-**This will separate the values and put in row wise (line by line).
-SET &CRLF= HEXBYT(13,'A1') | HEXBYT(10,'A1') ;
-SET &TEXT2=STRREP( &TESTVAR.LENGTH, &TESTVAR, 2, ', ', 2, &CRLF, &TESTVAR.LENGTH, 'A&TESTVAR.LENGTH' );

-**THIS COMMAND WILL RETURN THE WINDOWS SETTINGS, PATH AND CLASSPATH.

FILEDEF TEXT2 DISK C:\Kamesh\TEXT2.DAT
-RUN

? FILEDEF

- TYPE BEFORE PROCESS

-**Writes the value in to file (line by line).
-WRITE TEXT2 &TEXT2
-RUN
-CLOSE TEXT2

-**Sorting the values using DOS command and saving it in separate file.
-DOS SORT C:\Kamesh\TEXT2.DAT > C:\Kamesh\TEXT3.DAT

-DOS TYPE C:\Kamesh\TEXT2.DAT
-DOS TYPE C:\Kamesh\TEXT3.DAT

-**It will clear the old file from cache.
FILEDEF TEXT2 CLEAR

-**Retrieving the sorted file
FILEDEF TEXT3 DISK C:\Kamesh\TEXT3.DAT
-RUN

? FILEDEF

-SET &TT=' ';
-NEXTVAL
-READ TEXT3 &TT
-IF &IORETURN EQ 1 THEN GOTO ENDREAD ELSE GOTO CONTREAD;
-CONTREAD
-TYPE VALUES &TT
-GOTO NEXTVAL;
-ENDREAD


WFConsultant

WF 8105M on Win7/Tomcat
 
Posts: 780 | Location: Florida | Registered: January 09, 2005Report 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] Sort amper values

Copyright © 1996-2020 Information Builders