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] Sort by computed column?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Sort by computed column?
 Login/Join
 
Gold member
posted
I'm having trouble adding a level of sorting for my calculated column "MARPER" to my report with the columns:

PL_DESCRIPTION AS 'Product Line'
CUSTOMER_NAME AS 'Customer'
JOB_DESCRIPTION AS 'Job Address'
ORDER_NUM AS 'Ticket #'
ITEM_NUM AS 'SKU'
ITEM_DESCRIPTION AS 'Item Description'
INVOICE_DATE AS 'Invoice Date'
EXT_SALES_DOLLARS/D11BM AS 'Actual,Sales'
COMPUTE MARPER/D11.2B%S = ((EXT_SALES_DOLLARS - EXT_ACT_COST_COMM)/EXT_SALES_DOLLARS)*100; AS 'Margin,Act %'

BY SALESPERSON_NUM NOPRINT
BY CUSTOMER_NAME NOPRINT

I can add additional levels of sorting to any other column and it works fine, but when I add:

BY MARPER

...it doesn't sort by margin like I would expect it to.

I need to sort by customer name, then by margin within each customer. What's the trick?

Thanks.

This message has been edited. Last edited by: <Kathryn Henning>,



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Expert
posted Hide Post
Try BY TOTAL MARPER


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
Gold member
posted Hide Post
Thank you for the reply Waz, but that didn't work. BTW, my report is using the EXL07 format (although I tried EXL2K with the same result).

I also tried calculating an additional column called "Rank" that used a version of the margin formula to add as the 3rd sorting column but it didn't work either.

What am I missing?



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Gold member
posted Hide Post
quote:
Originally posted by Deej:
my report is using the EXL07 format

Actually... I'm going to have to keep it in EXL2K format because I need to burst the report through Report Caster and EXL07 doesn't support bursting.



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Gold member
posted Hide Post
If I remove one of the two levels of sorting above the MARPER column it sorts correctly.

Works:
BY SALESPERSON_NUM NOPRINT
-*BY CUSTOMER_NAME NOPRINT
BY TOTAL MARPER

Works:
-*BY SALESPERSON_NUM NOPRINT
BY CUSTOMER_NAME NOPRINT
BY TOTAL MARPER

It even sorts correctly when I move MARPER to the 2nd level of sorting.

Works:
BY SALESPERSON_NUM NOPRINT
BY TOTAL MARPER
BY CUSTOMER_NAME NOPRINT

But it still won't sort correctly when I put MARPER as the third level.

Doesn't work:
BY SALESPERSON_NUM NOPRINT
BY CUSTOMER_NAME NOPRINT
BY TOTAL MARPER

Is there something that has to do with the 3rd level being a computed/calculated column?



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Gold member
posted Hide Post
Glad to see it wasn't just me making a mistake.

Confused



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Virtuoso
posted Hide Post
Please post your whole code.


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
Gold member
posted Hide Post
Thanks Martin!

-SET &YESTER = DATECVT((DATEADD((DATECVT(&YYMD,'I8YYMD','YYMD')), 'M', -1)), 'YYMD','I8YYMD');
-SET &JMTH = LCWORD(9, CHGDAT('YYMD','MX',&YESTER,'A9'), 'A9');
-SET &JYRX = EDIT(&YESTER,'9999$$$$');

TABLE FILE MONTHLY_MARGIN_BY_SALESPERSON_OUTSIDE_VW
PRINT

	PL_DESCRIPTION AS 'Product Line'
	CUSTOMER_NAME AS 'Customer'
	JOB_DESCRIPTION AS 'Job Address'
	ORDER_NUM AS 'Ticket #'
	ITEM_NUM AS 'SKU'
	ITEM_DESCRIPTION AS 'Item Description'
	INVOICE_DATE AS 'Invoice Date'
	EXT_SALES_DOLLARS/D11BM AS 'Actual,Sales'
	COMPUTE MARPER/D11.2B%S = ((EXT_SALES_DOLLARS - EXT_ACT_COST_COMM)/EXT_SALES_DOLLARS)*100; AS 'Margin,Act %'

BY SALESPERSON_NUM NOPRINT
BY CUSTOMER_NAME NOPRINT
BY TOTAL MARPER




ON SALESPERSON_NUM PAGE-BREAK REPAGE

" "
HEADING
"Monthly Margin by Salesperson -- <SALESPERSON_NAME -- &JMTH.EVAL &JYRX.EVAL"
FOOTING
"&DATE<+0> <+0>&TOD<+0>                                                       Matrix/Dashboard/Monthly Margin by Salesperson - Outside.fex

ON TABLE SET PAGE-NUM OFF
ON TABLE SET BYDISPLAY ON
ON TABLE SUMMARIZE AS 'Total'
ON TABLE PCHOLD FORMAT EXL2K

ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Letter',
     LEFTMARGIN=0.000000,
     RIGHTMARGIN=0.000000,
     TOPMARGIN=0.000000,
     BOTTOMMARGIN=0.000000,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,

$
TYPE=REPORT,
     FONT='ARIAL',
     SIZE=10,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
TYPE=DATA,
     SIZE=8,
     BACKCOLOR=( RGB(234 234 255) 'WHITE' ),
$

TYPE=TITLE,
     BORDER-TOP=LIGHT,
     BORDER-BOTTOM=LIGHT,
     BORDER-LEFT=LIGHT,
     BORDER-RIGHT=LIGHT,
     SIZE=9,
     COLOR='WHITE',
     BACKCOLOR=RGB(147 172 219),
     STYLE=BOLD,
$
TYPE=TABHEADING,	SIZE=9,		BACKCOLOR=RGB(229 229 229),		STYLE=BOLD,$
TYPE=TABFOOTING,	SIZE=9,		BACKCOLOR=RGB(229 229 229),		STYLE=BOLD,$
TYPE=HEADING,		SIZE=9,		BACKCOLOR=RGB(232 232 232),		STYLE=BOLD,$
TYPE=FOOTING,		SIZE=9,		BACKCOLOR=RGB(229 229 229),$
TYPE=SUBHEAD,
     SIZE=9,
     STYLE=BOLD,
$
TYPE=SUBFOOT,
     BORDER-TOP=LIGHT,
     BORDER-BOTTOM=LIGHT,
     BORDER-LEFT=LIGHT,
     BORDER-RIGHT=LIGHT,
     SIZE=8,
     COLOR='WHITE',
     BACKCOLOR=RGB(147 172 219),
     STYLE=BOLD,
$
TYPE=SUBTOTAL,
     SIZE=8,
     STYLE=BOLD,
$
TYPE=ACROSSVALUE,
     SIZE=8,
     STYLE=BOLD,
$
TYPE=ACROSSTITLE,
     SIZE=8,
     STYLE=BOLD,
$
TYPE=GRANDTOTAL,
     SIZE=9,
     STYLE=BOLD,
$

ENDSTYLE
END




WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Gold member
posted Hide Post
So the full code didn't help?



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Expert
posted Hide Post
Try moving the compute into the by syntax -

BY TOTAL COMPUTE MARPER/D............ Etc.

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
Gold member
posted Hide Post
Thanks for the idea Tony. I actually hadn't tried that and was excited to try it.

Unfortunately, it didn't work either.

It did, however, put the lines which had zeros for margins at the top... just didn't sort the rest. It also didn't seem to differentiate between the MARPER in the PRINT statement and the MARPER in the BY statement, which I thought was interesting.

I put NOPRINT behind the BY statement (same as with the CUSTOMER_NAME) and the margin didn't print at all on the report. If I removed the NOPRINT, it printed the Margin Act in the last column and the MARPER at the first column.

I changed to BY MARPER COMPUTE NOPRINT and it printed the margin account, but still no sorting.

I'm stuck. Frowner



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report This Post
Virtuoso
posted Hide Post
I don't see why your code shouldn't work, but...

Since this is a non-aggregating (PRINT) request, you don't need to use COMPUTE at all.

Declare MARPER in a DEFINE FILE first, and then just reference it like any other incoming data item.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
quote:
Originally posted by j.gross:
I don't see why your code shouldn't work, but...

Since this is a non-aggregating (PRINT) request, you don't need to use COMPUTE at all.

Declare MARPER in a DEFINE FILE first, and then just reference it like any other incoming data item.

That WORKED! Thank you so much!



WebFOCUS 8.1.05
Windows, All Outputs
 
Posts: 67 | Registered: May 21, 2014Report 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] Sort by computed column?

Copyright © 1996-2020 Information Builders