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] Truncate/No-Rounding How To

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Truncate/No-Rounding How To
 Login/Join
 
Platinum Member
posted
I am using Focus 764 and I am unable to find a function to truncate. I have read all the posts out here but have yet to find one that will help me.

How do I stop this from rounding?

The below query doesn’t round up because it has change on the end. (I know I am using wheelbase and not an amount but it will work for now)

DEFINE FILE CAR
COST/D6.1=WHEELBASE
END
TABLE FILE CAR
PRINT COST
WHERE COST EQ 112.8;
ON TABLE COLUMN-TOTAL AS 'TOTAL';
END

This query will round up because the change is not printing.

DEFINE FILE CAR
COST/D6=WHEELBASE
END
TABLE FILE CAR
PRINT COST
WHERE COST EQ 112.8
ON TABLE COLUMN-TOTAL AS 'TOTAL';
END

What I need

No rounding and no change showing for rows
No rounding but a column-total including change but no change showing

Sounds crazy but that’s what they want.

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


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 156 | Registered: August 23, 2010Report This Post
Platinum Member
posted Hide Post
Here is an Example.
Cost No Change Actual Cost What They Want
56,827,057 56,827,057.6 56,827,057
72,726,183 72,726,183.4 72,726,183
14,690,392 14,690,392.7 14,690,392
2,067,826 2,067,826.9 2,067,826
TOTAL 146,311,458 146,311,460.6 146,311,460


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 156 | Registered: August 23, 2010Report This Post
Platinum Member
posted Hide Post
Ex
Cost No/CHG Actual Cost What They Want
56,827,057 56,827,057.6 56,827,057
72,726,183 72,726,183.4 72,726,183
14,690,392 14,690,392.7 14,690,392
2,067,826 2,067,826.9 2,067,826
TOT 146,311,458 146,311,460.6 146,311,460


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 156 | Registered: August 23, 2010Report This Post
Platinum Member
posted Hide Post
Oh well I can't find out to attach a file to this thing so here is what they are looking for. The rows don't round or show change total does not show change and does not round but is a total of all with change.

56,827,057
72,726,183
14,690,392
2,067,826
146,311,460


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 156 | Registered: August 23, 2010Report This Post
Member
posted Hide Post
quote:
DEFINE FILE CAR
COST/D6.1=WHEELBASE
END
TABLE FILE CAR
PRINT COST
WHERE COST EQ 112.8;
ON TABLE COLUMN-TOTAL AS 'TOTAL';
END


You can try
   
DEFINE FILE CAR
COST/D6.1=WHEELBASE
END
TABLE FILE CAR
PRINT COST 
COMPUTE TRUNCATED_COST/D6=INT(COST);
COMPUTE RUNNING_TOTAL_COST/D8.1=RUNNING_TOTAL_COST + COST;
COMPUTE TRUNCATED_TOTAL_COST/D8=INT(RUNNING_TOTAL_COST);
WHERE COST EQ 112.8;
ON TABLE COLUMN-TOTAL AS 'TOTAL'
END


Which will only give you the integer portion of the number.
You can do a running total to add them up with the decimal and then INT that value to get it truncated but with the decimals added. Not sure how you would put it in a total easily though.

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


WebFOCUS 8.1.05
Windows-iSeries DB2, All Outputs
HTML
 
Posts: 29 | Location: Cincinnati, OH | Registered: August 23, 2011Report This Post
Expert
posted Hide Post
i can't understand your objective
but be aware that Integer format truncates.
DEFINE FILE CAR
COST/I6 = WHEELBASE;
END
...and you get a truncated value.
If you want to keep track of something with decimal postions, but not show it until the total,
then PRINT COST WHEELBASE NOPRINT
and ON TABLE SUBFOOT
"EG:
DEFINE FILE CAR
COST/I6=WHEELBASE;
END
 
TABLE FILE CAR
SUM COST WHEELBASE NOPRINT BY COUNTRY BY CAR
ON TABLE SUBFOOT
"  <TOT.COST"
" Wheelbase= <TOT.WHEELBASE  "
ON TABLE SET STYLE *
TYPE=TABFOOTING, LINE=1,JUSTIFY=RIGHT,$
 
END




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Guru
posted Hide Post
Take a look at this:
DEFINE FILE CAR
COST/D6.1=WHEELBASE;
FRACT_PART/D6.1= DMOD(COST,1,FRACT_PART);
COST_NOCHANGE/D6=COST-FRACT_PART;
END
TABLE FILE CAR
PRINT WHEELBASE COST FRACT_PART COST_NOCHANGE
ON TABLE SUBTOTAL
END

HTH


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Virtuoso
posted Hide Post
COMPUTE can be used instead of DEFINE:
TABLE FILE CAR
PRINT 
COMPUTE COST/I6=WHEELBASE;
ON TABLE RECOMPUTE AS 'TOTAL'
END


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
Ok, thanks for all the posts, I think what I will have to do is print this out in one report using the define to get my nochange number.
FRACT_PART/D6.1= DMOD(COST,1,FRACT_PART);
COST_NOCHANGE/D6=COST-FRACT_PART;
Then I could run a second report as a compound report for the totals, but how do you only print totals?


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 156 | Registered: August 23, 2010Report This Post
Guru
posted Hide Post
Lookup Multiple Display Commands; this topic may address your need.

Edited to add: also see prefix operators.

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


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Platinum Member
posted Hide Post
Ok I was able to get my totals in one row by using the code below, but it is still rounding. Why is there not a -SET ROUNDING OFF; ????

DEFINE FILE CAR
TOTAL/A5='TOTAL';
END
TABLE FILE CAR
SUM TOTAL AS ''
RETAIL_COST
RETAIL_COST
WHEELBASE/P11M
WHERE WHEELBASE EQ 98.4 OR 103.8 OR 105.3;
ON TABLE SET PAGE-NUM OFF
END

I did find out by trial and error that if you change the format of the Wheelbase column from P11M to I11M it will not round. So Packed Rounds and Integer does not.

DEFINE FILE CAR
TOTAL/A5='TOTAL';
END
TABLE FILE CAR
SUM TOTAL AS ''
RETAIL_COST
RETAIL_COST
WHEELBASE/I11M
WHERE WHEELBASE EQ 98.4 OR 103.8 OR 105.3;
ON TABLE SET PAGE-NUM OFF
END

Problem I still have is that when I do this my total is off because it does not add in the change.  Not sure why they want it like this but they do. So Details don’t round and don’t include change. Total does not round but does include change. I will keep working…..At least I found out how to stop it from rounding.


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 156 | Registered: August 23, 2010Report This Post
Virtuoso
posted Hide Post
I am not sure why you need to make this so complex.
DEFINE FILE CAR
ActualCost/D12.2 = 
IF COUNTRY EQ 'ENGLAND' THEN 56827057.6 ELSE
IF COUNTRY EQ 'FRANCE'  THEN 72726183.4 ELSE
IF COUNTRY EQ 'ITALY'  THEN  14690392.7 ELSE
IF COUNTRY EQ 'JAPAN'  THEN   2067826.9 ELSE 0;
END
TABLE FILE CAR
PRINT
COMPUTE CostNoChange/I11CM = ActualCost; AS 'What They Want'
BY COUNTRY
IF COUNTRY NE 'W GERMANY'
ON TABLE RECOMPUTE AS 'TOTAL'
END

gives the result you gave in your example, or is there something else going on?


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Platinum Member
posted Hide Post
It's not complex when you know what you are doing. This is a first for me, but this looks like it worked. Here is my code.

DEFINE FILE P1333_CAS_PAP
NBMA/D13.1= IF NEW_BUSINESS_MONTH_A GT 0 THEN NEW_BUSINESS_MONTH_A ELSE 0;
NBPC/D13.1= IF NEW_BSNS_POL_CNT GT 0 THEN NEW_BSNS_POL_CNT ELSE 0;
NBMC/D13.1= IF NEW_BUSINESS_MONTH_C GT 0 THEN NEW_BUSINESS_MONTH_C ELSE 0;
NBVC/D13.1= IF NEW_BSNS_VEH_CNT GT 0 THEN NEW_BSNS_VEH_CNT ELSE 0;
NBME/D13.1= IF NEW_BUSINESS_MONTH_E GT 0 THEN NEW_BUSINESS_MONTH_E ELSE 0;
NBPA/D13.1= IF NEW_BSNS_PREM_AMT GT 0 THEN NEW_BSNS_PREM_AMT ELSE 0;
NRMG/D13.1= IF RENEWAL_MONTH_G GT 0 THEN RENEWAL_MONTH_G ELSE 0;
NRPA/D13.1= IF RENW_PREM_AMT GT 0 THEN RENW_PREM_AMT ELSE 0;
TOT1/D13.1=(NEW_BUSINESS_MONTH_E + RENEWAL_MONTH_G);
TOT2/D13.1=(NEW_BSNS_PREM_AMT + RENW_PREM_AMT);
TOTAL/A5='TOTAL';
END
TABLE FILE P1333_CAS_PAP
SUM TOTAL AS ''
COMPUTE AMOUNT1/I11CM = NBMA; AS ''
COMPUTE AMOUNT1/I11CM = NBPC; AS ''
COMPUTE AMOUNT1/I11CM = NBMC; AS ''
COMPUTE AMOUNT1/I11CM = NBVC; AS ''
COMPUTE AMOUNT1/I11CM = NBME; AS ''
COMPUTE AMOUNT1/I11CM = NBPA; AS ''
COMPUTE AMOUNT1/I11CM = NRMG; AS ''
COMPUTE AMOUNT1/I11CM = NRPA; AS ''
COMPUTE AMOUNT1/I11CM = TOT1; AS ''
COMPUTE AMOUNT1/I11CM = TOT2; AS ''
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT EXL2K CLOSE
END


Thanks to all and to Alan B for your help, this one will go into my ongoing WTF file.

Now how to I add Solved to the title of this thread?


WebFOCUS 8105m
Windows, All Outputs
 
Posts: 156 | Registered: August 23, 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] Truncate/No-Rounding How To

Copyright © 1996-2020 Information Builders