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     TRUNCATE function - is it documented?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
TRUNCATE function - is it documented?
 Login/Join
 
Expert
posted
I cannot find any documentation for the TRUNCATE function in the 5.3.2 docs. Is it documented in a newer release?

It appears that it only works in Dialogue Manager, I tried it in a DEFINE and got

(FOC263) EXTERNAL FUNCTION OR LOAD MODULE NOT FOUND: TRUNCATE

I realize it may not make sense to use it in a DEFINE.


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
Guru
posted Hide Post
I'm on version 536 and the TRUNCATE function does not exist. I receive the same error message you are getting.

This is how we do it:

DEFINE FILE CAR
TAX/D12.4 = .08125;
SALESTAX/D12.4 =
TRUNC_SALESTAX/D12.2 = EDIT(STRIP(14,SUBSTR(14, FTOA(SALESTAX*100, '(D12.2)', 'A14'), 1,
(POSIT(FTOA(SALESTAX*100, '(D12.2)', 'A14'), 14, '.', 1, 'I2'))-1, 14, 'A14'), ',', 'A14'))/100;
DRIVEOUT/D12.2 = TRUNCATE(RETAIL_COST * TAX);
END
-*
TABLE FILE CAR
PRINT
RETAIL_COST
TAX
SALESTAX
TRUNC_SALESTAX
DRIVEOUT
ON TABLE PCHOLD FORMAT EXL2K
END

I'm sure there is a shorter way but this is the one I came up with on the fly.

Glenda


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Guru
posted Hide Post
DEFINE FILE CAR
TAX/D12.4 = .08125;
SALESTAX/D12.4 = RETAIL_COST * TAX;
TRUNC_SALESTAX/D12.2 = EDIT(STRIP(14,SUBSTR(14, FTOA(SALESTAX*100, '(D12.2)', 'A14'), 1,
(POSIT(FTOA(SALESTAX*100, '(D12.2)', 'A14'), 14, '.', 1, 'I2'))-1, 14, 'A14'), ',', 'A14'))/100;
DRIVEOUT/D12.2 = TRUNCATE(RETAIL_COST * TAX);

END

TABLE FILE CAR
PRINT
RETAIL_COST
TAX
SALESTAX
TRUNC_SALESTAX
DRIVEOUT
ON TABLE PCHOLD FORMAT EXL2K
END


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Guru
posted Hide Post
Ok, I must be sleeping. I don't know what happened on the first post.

The second was where I tried the truncate function to see what the error message was I received.

If you take out

DRIVEOUT/D12.2 = TRUNCATE(RETAIL_COST * TAX);

the query will run.

Sorry for all the confusion.

I think I'll go take a nap now Music


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Virtuoso
posted Hide Post
quote:
(FOC03665) Error loading external function 'TRUNCATE'This function can only be used in Dialogue Manager commands that support function calls, such as ‑SET and ‑IF commands. It cannot be used in ‑TYPE or ‑CRTFORM commands or in arguments passed to stored procedures.

You can't use it in a define statement. OR maybe you can based on Glenda's test but that's a numeric calculation she's doing so who knows.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Guru
posted Hide Post
Leah,

Your are correct. I don't use the TRUNCATE function. Instead, I came wrote a numerica calculation to use in place of the TRUNCATE function.


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Guru
posted Hide Post
Here's where the doco is

http://documentation.informationbuilders.com/masterinde...g/source/topic44.htm

And it works in DM only.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Expert
posted Hide Post
although it would take me more than a long nap to understand Glenda's DEFINE's... ( we need a smiley for head spinning out of control)
if what you want to do is essentially ROUNDDOWN an end result, then you can write your own TRUNCATE function and stick it in your edasprof.
eg:

-SET &ECHO = ALL ;
 

DEFINE FILE CAR
SALESTAX/D9.4 = .0825 ;
TAX/D9.4=SALES * SALESTAX;
temp1/I9=( TAX * 100) ;
rightanswer/P9.2=temp1/100;
wronganswer/P9.2= TAX;
END

TABLE FILE CAR 
PRINT SALES SALESTAX TAX  temp1 rightanswer wronganswer
COMPUTE OOPS/D9.2S=rightanswer - wronganswer;
ON TABLE HOLD AS MYTAB FORMAT HTMTABLE
END
-RUN
-STEP2
DEFINE FUNCTION F_TRUNC(number/D9.4)
temp1/I9= number * 100 ;
F_TRUNC/P9.2= temp1/100;
END
DEFINE FILE CAR
SALESTAX/D9.4 = .0825 ;
rightanswer/P9.2=F_TRUNC(SALES * SALESTAX);

END
TABLE FILE CAR 
PRINT SALES SALESTAX     rightanswer  
ON TABLE HOLD AS MYTAB1 FORMAT HTMTABLE
 END
-RUN
-HTMLFORM BEGIN
<TABLE><TR><TD>
!IBI.FIL.MYTAB;
<TD>!IBI.FIL.MYTAB1;
</TABLE>
-HTMLFORM 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
Sorry about that. I'm not quite the experts you all are. Big Grin


Glenda

In FOCUS Since 1990
Production 8.2 Windows
 
Posts: 301 | Location: Galveston, Texas | Registered: July 07, 2004Report This Post
Virtuoso
posted Hide Post
Of course this is silly to ask now, Francis, but are truncating numbers or character strings?


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
I was truncating character strings. Since I used TRUNCATE to concatenate First Name and Last Name Dialogue Manager variables, I thought I would modify the technique I use in a COMPUTE or DEFINE to use TRUNCATE instead of hard concatenation with a blank in between. But TRUNCATE only works in Dialogue Manager.

Cheers.


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

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     TRUNCATE function - is it documented?

Copyright © 1996-2020 Information Builders