Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Ordering Row Values
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Ordering Row Values
 Login/Join
 
Platinum Member
posted
Hi,
I have a report as below.
  
Product   	Sales    Count
Product1  	xxx      zzz 
Product2  	yyy      rrr
Product3  	zzz      hhh
product4        bbb      nnn
product5        ccc      jjj
Total-A         aaa      vvv
Total-B         ddd      lll


Total-A should come after the row Product3 and Total-B should come as the last row.
I have used a sequence operation for ordering columns via GUI
Since i have used lots of hold files in my actual report i cannot open this in GUI.
Is there any way to give this sequence for Rows.

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


WF8202M,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 207 | Location: MI | Registered: September 13, 2017Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Since I don't know how your files have been created and because it think that you may have several hold files merged together, the easiest way is to create a row indicator for each.

Sample
TABLE FILE GGSALES
SUM DOLLARS
BY CITY
BY REGION
BY TOTAL COMPUTE TOTID   /I2  = 0;
BY PRODUCT
ON TABLE HOLD AS DETDATA
END

TABLE FILE GGSALES
SUM DOLLARS
BY CITY
BY REGION
BY TOTAL COMPUTE TOTID   /I2  = 2;
BY TOTAL COMPUTE PRODUCT /A16 = 'TOTAL';
ON TABLE HOLD AS TOTDATA
END

TABLE FILE DETDATA
SUM DOLLARS
BY CITY
BY REGION
BY TOTID NOPRINT
BY PRODUCT
MORE
FILE TOTDATA
END


But above can be accomplished with this

TABLE FILE GGSALES
SUM DOLLARS
BY CITY
BY REGION
BY PRODUCT
ON REGION SUBTOTAL
END


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Virtuoso
posted Hide Post
srajeevan,
You don't say what Total-A and Total-B are.
Is Total-A the sum of Products 1,2,3 and Total-B the sum of 4,5?
If so, use a DEFINE:
  
DEFINE FILE myfile
T/A1=IF PRODUCT EQ 'Product1' OR 'Product2' OR 'Product3' THEN 'A' ELSE 'B';
END
TABLE FILE myfile
SUM SALES COUNT
BY T NOPRINT
BY PRODUCT
ON T SUBTOTAL
ON TABLE NOTOTAL
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1932 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Danny-SRL

Nice Thread


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Suppose i have the car file and i am displaying three countries sales(by applying filter) with Country name as first BY Field.
But i want to display those three countries in a specific order not alphabetically as wf does default.
I was hoping for a solution for that.
Daniel: I wont be able to use your solution as Total A and B is not subtotals ,it is another mathematical calculation.
MartinY: I will try your solution of giving a row indicator for each.But product 1 ,product 2 ,product 3 comes from master file and Total Field is a compute field.How can i give row Id for product 1 ,2,3.?Is it possible.


WF8202M,Windows 7,8,10
HTM,PDF,EXCEL
 
Posts: 207 | Location: MI | Registered: September 13, 2017Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Adding ROWS .. OVER .. to your BY will help to put the values in a specific order.

BY sortfield AS 'coltitle' ROWS value1 [AS 'text1']
OVER value2 [AS 'text2']
[... OVER valuen [ AS 'textn']]
END


WebFocus 8203M, iWay DataMigrator, Windows, DB2 Windows V10.5, MS SQL Server, Azure SQL, Hyperstage, ReportCaster
 
Posts: 152 | Registered: March 29, 2013Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Srajeevan,

A possibility...
  
-* File srajeevan01.fex
DEFINE FILE CAR
PRODUCT/A20=IF CAR EQ 'JAGUAR' OR 'TOYOTA' OR 'DATSUN' OR 'AUDI' OR 'TRIUMPH' THEN CAR ELSE
            IF CAR EQ 'BMW' THEN 'TOTAL-A' ELSE 
			IF CAR EQ 'MASERATI' THEN 'TOTAL-B' ELSE ' ';
SEQ/I1=DECODE PRODUCT(JAGUAR 1 TOYOTA 2 DATSUN 3 'TOTAL-A' 4 AUDI 5 TRIUMPH 6 'TOTAL-B' 7 ELSE 0); 
Sales/I6 = IF SEQ EQ 1 OR 2 OR 3 OR 5 OR 6 THEN SALES ELSE
           IF SEQ EQ 4 THEN SALES * LOG(SEATS) + RCOST ELSE
		                    (WIDTH + HEIGHT) ** 2;
END
TABLE FILE CAR
SUM Sales CNT.Sales AS Count
BY SEQ NOPRINT
BY PRODUCT
IF PRODUCT NE ' '
END


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1932 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Another option to create row indicator.
My below sample has no sense, but it show the technic of using LAST and avoid of coding all possible values within a DECODE or IF.
But it may not be applicable. Each situation has its own solution.

TABLE FILE CAR
SUM RETAIL_COST
BY TOTAL COMPUTE ROWID /I2 = IF COUNTRY EQ LAST COUNTRY THEN ROWID ELSE ROWID + 1;
BY SEATS
BY COUNTRY
END


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Ordering Row Values

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.