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     [CLOSED] Removing Trailing Occurrences with the TRIM function: Bad example in Doc.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Removing Trailing Occurrences with the TRIM function: Bad example in Doc.
 Login/Join
 
Expert
posted
quote:
Example: Removing Trailing Occurrences
TRIM removes trailing occurrences of the characters ER from the TITLE. In order to remove trailing non-blank characters, trailing spaces must be removed first. The TITLE field has trailing spaces. Therefore, TRIM does not remove the characters ER when creating field TRIMT. The SHORT field does not have trailing spaces. Therefore, TRIM removes the trailing ER characters when creating field TRIMS:
DEFINE FILE MOVIES
SHORT/A19 = SUBSTR(19, TITLE, 1, 19, 19, SHORT);
END
TABLE FILE MOVIES
PRINT  TITLE  IN 1  AS 'TITLE: '
       SHORT  IN 40 AS 'SHORT: ' OVER
COMPUTE
  TRIMT/A39 = TRIM('T', TITLE, 39, 'ER', 2, 'A39'); IN 1 AS 'TRIMT: '
COMPUTE
  TRIMS/A19 = TRIM('T', SHORT, 19, 'ER', 2, 'A19'); IN 40 AS 'TRIMS: ' 
WHERE TITLE LIKE '%ER'
END
The output is:
TITLE:   LEARN TO SKI BETTER         SHORT:   LEARN TO SKI BETTER
TRIMT:   LEARN TO SKI BETTER         TRIMS:   LEARN TO SKI BETT  
TITLE:   FANNY AND ALEXANDER         SHORT:   FANNY AND ALEXANDER
TRIMT:   FANNY AND ALEXANDER         TRIMS:   FANNY AND ALEXAND

This will only work if you know exactly how long the resulting value will be. I think this is a bad example on how to trim trailing occurrences of a string. It would be better for the example to use Right Justify, Trim, Left Justify:

TABLE FILE CAR
PRINT
COUNTRY
COMPUTE TRIMT/A10 = LJUST(10, TRIM('T', RJUST(10, COUNTRY, 'A10'), 10, 'AND', 3, 'A10'), 'A10');
END

Resulting in:
COUNTRY    TRIMT 
---------  ---------
ENGLAND    ENGL 
JAPAN      JAPAN 
ITALY      ITALY 
W GERMANY  W GERMANY 
FRANCE     FRANCE 

This message has been edited. Last edited by: Francis Mariani,


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
Expert
posted Hide Post
Hi Francis,

Thanks for noting. I will forward to the documentation group for them to review.

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
 
Posts: 1948 | Location: New York | Registered: November 16, 2004Report 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     [CLOSED] Removing Trailing Occurrences with the TRIM function: Bad example in Doc.

Copyright © 1996-2020 Information Builders