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     Convert negative number to positive

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Convert negative number to positive
 Login/Join
 
Platinum Member
posted
This is more than meets the eye.
The question is: I need to use the negative number in the calculation/total but display it as a positive; i.e. without the negative sign, when the Account Type is EXPENSE
This, not very well formatted, copy and paste of the report shows an attempt. The data after the EXPENSE prints correctly, but the total is double what it should be. The total should be $.00 as shown in the next column.


Title Account Type ACCTD2 Accepted Budget YTD Activity Encumberance Remaining Balance
Ferris State University REVENUE 189,253,828.64 $189,253,828.64 $147,852,814.26 $.00 $41,401,014.38
Ferris State University EXPENSE 189,253,828.64 -$189,253,828.64 -$131,054,671.70 -$31,248,584.96 -$26,950,571.98

TOTAL
378,507,657.28 $.00 $16,798,142.56 -$31,248,584.96 $14,450,442.40


Reporting Server 7.6.10
Dev. Studio 7.6.8
Windows NT
Excel, HTML, PDF
 
Posts: 204 | Registered: March 31, 2008Report This Post
Virtuoso
posted Hide Post
There could be a simpler method but I'd do in your case would be to create 2 fields:

- An actual field that carries the "real" value to be used (-189,253,828.64) - NOPRINT
- A "display" field which constains the abosulte value of the previous one (see ABS() for reference)

The trade off here is that you won't be able to use SUBTOTAL/TOTAL anymore but will have to resort to SUBFOOT to position each column totals where you want it.

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
This sample code using the CAR table illustrates the concept:
DEFINE FILE CAR
ACCTD2/A7 WITH BODYTYPE = IF BODYTYPE EQ 'SEDAN' THEN 'REVENUE' ELSE 'EXPENSE';
SORT_SQ/I2 = IF ACCTD2 EQ 'REVENUE' THEN 1 ELSE 2;
BUDGET/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN SALES*200 ELSE (-1 * SALES*200);
ACCEPTED/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN RETAIL_COST ELSE (-1 * RETAIL_COST);
ACCEPTED_DSP/D12.2 = ABS(ACCEPTED);
END
TABLE FILE CAR
SUM
      ACCEPTED     NOPRINT
      ACCEPTED_DSP AS 'Accepted'
      BUDGET       AS 'Budget'
BY SORT_SQ NOPRINT
BY ACCTD2
ON TABLE SUBTOTAL AS 'WRONG TOTAL'
ON TABLE SUBFOOT
"RIGHT TOTAL<+0><TOT.ACCEPTED<TOT.BUDGET"
ON TABLE SET STYLE *
TYPE=GRANDTOTAL, COLOR='RED',$
TYPE=TABFOOTING, HEADALIGN=BODY, JUSTIFY=RIGHT, COLOR='BLUE',$
TYPE=TABFOOTING, OBJECT=TEXT, JUSTIFY=LEFT,$
END


ACCEPTED refers to the actual amounts (both positive and negative) you're report is dealing with. This field is not displayed in the body of your report but is used to calculate the "right" total at the end.
ACCEPTED_DSP is the field you used to display the expected values in your report with *no* negative sign. That field is not supposed to be used in totals as it only has positive values.

You can apply the concept to your own report; it requires an extra piece of work (use of SUBFOOT instead of TOTAL/SUBTOTAL) but gives more control (relatively speaking) in what you actually want to display.

Hope that helps,
- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Platinum Member
posted Hide Post
Thanks. WOrking on. I'm having trouble positioning the totals. Spot markers don't seem to do anything anymore <+20>


Reporting Server 7.6.10
Dev. Studio 7.6.8
Windows NT
Excel, HTML, PDF
 
Posts: 204 | Registered: March 31, 2008Report This Post
Virtuoso
posted Hide Post
Which output format are you using? If it's exclusively HTML or EXL2K then a HEADALIGN=BODY in the style sheet definition on TYPE=GRANDTOTAL and/or TYPE=SUBFOOT is usually sufficient (see my example which does exactly that).

If PDF, then you may play with POSITION={column} for each ITEM in your SUBFOOT or GRANDTOTAL.

Using spotmarkers can be quite cumbersome sometimes (most times? Wink ) but HEADALIGN and/or POSITION have proven to be very useful for me in the past and the only markers I need are <+0> (no offset).

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
Rick, just a little "caveat" you should keep in mind before it's too late. Just be aware of the fact that, when declaring your style definitions, SUBFOOT can only have BORDERs around the whole block and not around each internal column or line, as opposed to SUBTOTAL and GRANDTOTAL which give you more control in styling (but not that much in their content).

As I said before, it's a trade off. My users pretty much accepted to live without those fancy borders as long as the information presented is consistent and accurate. Other environments may not be as forgiving Smiler

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Platinum Member
posted Hide Post
Thanks much. I'm having trouble positioning the SUBFOOT and I need that because that is what the report uses. I would like to use column notation to position, P4.

Here is my code

DEFINE FILE CAR
ACCTD2/A7 WITH BODYTYPE = IF BODYTYPE EQ 'SEDAN' THEN 'REVENUE' ELSE 'EXPENSE';
SORT_SQ/I2 = IF ACCTD2 EQ 'REVENUE' THEN 1 ELSE 2;
BUDGET/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN SALES*200 ELSE (-1 * SALES*200);
ACCEPTED/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN RETAIL_COST ELSE (-1 * RETAIL_COST);
ACCEPTED_DSP/D12.2 = ABS(ACCEPTED);
END
TABLE FILE CAR
SUM
     CAR
     MODEL
     BODYTYPE
     ACCEPTED NOPRINT
     ACCEPTED_DSP AS 'Accepted'
     BUDGET AS 'Budget'
BY SORT_SQ NOPRINT
BY ACCTD2
ON TABLE SUBFOOT
"RIGHT TOTAL<+0><TOT.ACCEPTED<+0><TOT.BUDGET"
ON TABLE SUBTOTAL AS 'WRONG TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Legal',
     SQUEEZE=ON,
     ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='COURIER',
     SIZE=9,
$
TYPE=GRANDTOTAL, COLOR='RED',$
-*TYPE=TABFOOTING, HEADALIGN=BODY, COLOR='BLUE',$
-*TYPE=TABFOOTING, OBJECT=TEXT, JUSTIFY=LEFT,$
TYPE=TABFOOTING, LINE=1, OBJECT=FIELD, ITEM=2, POSITION=3.5,$
ENDSTYLE
END


Reporting Server 7.6.10
Dev. Studio 7.6.8
Windows NT
Excel, HTML, PDF
 
Posts: 204 | Registered: March 31, 2008Report This Post
Expert
posted Hide Post
Rick,

Use HEADALIGN=BODY with spotmarkers -

DEFINE FILE CAR
  ACCTD2/A7 WITH BODYTYPE = IF BODYTYPE EQ 'SEDAN' THEN 'REVENUE' ELSE 'EXPENSE';
  SORT_SQ/I2 = IF ACCTD2 EQ 'REVENUE' THEN 1 ELSE 2;
  BUDGET/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN SALES*200 ELSE (-1 * SALES*200);
  ACCEPTED/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN RETAIL_COST ELSE (-1 * RETAIL_COST);
  ACCEPTED_DSP/D12.2 = ABS(ACCEPTED);
END
TABLE FILE CAR
 SUM CAR
     MODEL
     BODYTYPE
     ACCEPTED     NOPRINT
     ACCEPTED_DSP AS 'Accepted'
     BUDGET       AS 'Budget'
BY SORT_SQ NOPRINT
BY ACCTD2
ON TABLE SUBFOOT
"RIGHT TOTAL <+0> <+0> <+0> <TOT.ACCEPTED<TOT.BUDGET"
ON TABLE SUBTOTAL AS 'WRONG TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
  UNITS=IN, PAGESIZE='Legal', SQUEEZE=ON, ORIENTATION=LANDSCAPE, $
TYPE=REPORT, GRID=OFF, FONT='COURIER', SIZE=9, $
TYPE=GRANDTOTAL, COLOR='RED',$
TYPE=TABFOOTING, HEADALIGN=BODY, JUSTIFY=RIGHT, $
ENDSTYLE
END

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
Platinum Member
posted Hide Post
You guys are sharp. So it appears that this technique only works with PDF. Is there a way to also be able to output in Excel, EXL2K?


Reporting Server 7.6.10
Dev. Studio 7.6.8
Windows NT
Excel, HTML, PDF
 
Posts: 204 | Registered: March 31, 2008Report This Post
Platinum Member
posted Hide Post
EXL2K look same as HTML to me. PDF have RIGHT TOTAL in side two cols.

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
 
Posts: 106 | Registered: April 06, 2009Report This Post
Virtuoso
posted Hide Post
quote:
So it appears that this technique only works with PDF. Is there a way to also be able to output in Excel, EXL2K?


You probably did not read my reply on that yesterday (or maybe it was not that clear?):
quote:
Which output format are you using? If it's exclusively HTML or EXL2K then a HEADALIGN=BODY in the style sheet definition on TYPE=GRANDTOTAL and/or TYPE=SUBFOOT is usually sufficient (see my example which does exactly that).

If PDF, then you may play with POSITION={column} for each ITEM in your SUBFOOT or GRANDTOTAL.


In summary, use POSITION when dealing with PDF. Use HEADALIGN=... when HTML and EXL2K. In either case use spot markers (<+0>) to separate your SUBFOOT components so you can individually reference them in the style sheet definition via the ITEM keyword.

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Platinum Member
posted Hide Post
Sorry, if I add CAR MODEL the 'Right' numbers don't fall under the correct columns.


Reporting Server 7.6.10
Dev. Studio 7.6.8
Windows NT
Excel, HTML, PDF
 
Posts: 204 | Registered: March 31, 2008Report This Post
Platinum Member
posted Hide Post
You need spot markers in your subfoot logic to account for all columns being displayed in the report. See the code below:

DEFINE FILE CAR
ACCTD2/A7 WITH BODYTYPE = IF BODYTYPE EQ 'SEDAN' THEN 'REVENUE' ELSE 'EXPENSE';
SORT_SQ/I2 = IF ACCTD2 EQ 'REVENUE' THEN 1 ELSE 2;
BUDGET/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN SALES*200 ELSE (-1 * SALES*200);
ACCEPTED/D12.2 = IF ACCTD2 EQ 'REVENUE' THEN RETAIL_COST ELSE (-1 * RETAIL_COST);
ACCEPTED_DSP/D12.2 = ABS(ACCEPTED);
END
TABLE FILE CAR
SUM
     CAR
     MODEL
     BODYTYPE
     ACCEPTED NOPRINT
     ACCEPTED_DSP AS 'Accepted'
     BUDGET AS 'Budget'
BY SORT_SQ NOPRINT
BY ACCTD2
ON TABLE SUBFOOT
"RIGHT TOTAL<+0> <+0> <+0> <+0><TOT.ACCEPTED<+0><TOT.BUDGET"
ON TABLE SUBTOTAL AS 'WRONG TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Legal',
     SQUEEZE=ON,
     ORIENTATION=LANDSCAPE,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='COURIER',
     SIZE=9,
$

TYPE=GRANDTOTAL, COLOR='RED',$
TYPE=TABFOOTING, HEADALIGN=BODY, COLOR='BLUE',$
-*TYPE=TABFOOTING, OBJECT=TEXT, JUSTIFY=LEFT,$
TYPE=TABFOOTING, LINE=1, OBJECT=FIELD, ITEM=2, POSITION=3.5,$
ENDSTYLE
END  



PAGE 1



ACCTD2 CAR MODEL BODYTYPE Accepted Budget
REVENUE PEUGEOT 504 4 DOOR SEDAN 114,086.00 36,604,000.00
EXPENSE ALFA ROMEO 2000 SPIDER VELOCE ROADSTER 59,118.00 -5,080,000.00

WRONG TOTAL 173,204.00 31,524,000.00
RIGHT TOTAL 54,968.00 31,524,000.00


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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Convert negative number to positive

Copyright © 1996-2020 Information Builders