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     [CLOSED] TRUNCATE in a Function?
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] TRUNCATE in a Function?
 Login/Join
 
Platinum Member
posted
Hi All,

I've haven't done too much work with Functions. I often just use an include statement for the sake of modularity (but I don't feel that's good practice).

I would like to know why I am having problems with the following function. This function should take a parameter (QUOTE_ME) and add quotes in the right spots if they do not exist (in the case of strings). If quotes do exist then the input should match the output.

DEFINE FUNCTION QUOTEANATOR(QUOTE_ME/A1000)
    QUOTE_ME = TRUNCATE(QUOTE_ME);

    QUOTE_ME = STRREP (QUOTE_ME.LENGTH,QUOTE_ME,1,'''',0,'',1000,'A1000');
    QUOTE_ME = TRUNCATE(QUOTE_ME);

    QUOTE_ME = '''' || STRREP (QUOTE_ME.LENGTH,QUOTE_ME,4,' OR ',6,''' OR ''',1000,'A1000') || '''';
    QUOTE_ME = TRUNCATE(QUOTE_ME);

    QUOTEANATOR/A1000 = QUOTE_ME;
END

The error message I get is:

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

Anyone know why TRUNCATE doesn't work? Am I making some syntax error? I've tried to put a - at the start of the lines, but that wasn't successful. I am using other Functions that I have created and used for a long time as templates, and they work fine.

Thanks again great community!

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


WebFOCUS 8201, SP 0.1, Windows 7, HTML
 
Posts: 187 | Registered: May 19, 2017Reply With QuoteReport This Post
Expert
posted Hide Post
How about replacing TRUNCATE with RTRIM ?


Also, I don't like the reuse of fields especially without a format.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.06OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6272 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Did not know that TRUNCATE exist in WF...

Look at the following functions
Simplified Character Functions


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: 2341 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Master
posted Hide Post
@martinY

actually, it does. But only als a DM command.

-SET &A = 'bye bye                     ';
-SET &B = TRUNCATE(&A);

-TYPE &A.LENGTH
-TYPE &B.LENGTH


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 669 | Location: Veghel, The Netherlands | Registered: February 16, 2010Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Um, ok... I'll try RTRIM. But why doesn't TRUNCATE work? Is it because it is a DM command, and DM commands don't work in functions?

Thanks!


WebFOCUS 8201, SP 0.1, Windows 7, HTML
 
Posts: 187 | Registered: May 19, 2017Reply With QuoteReport This Post
Master
posted Hide Post
Shingles, because it is part of DM Language and not part of the FOCUS language. That is like asking why the COBOL MOVE command doesn't work in JCL.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 956 | Location: Oklahoma City | Registered: October 27, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Thanks jgelona... and I'm guessing DM isn't allowed in Functions. I haven't been at FOCUS for long, so this is news to me.


WebFOCUS 8201, SP 0.1, Windows 7, HTML
 
Posts: 187 | Registered: May 19, 2017Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] TRUNCATE in a Function?

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