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] Remove Leading Zeroes and Trailing spaces

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Remove Leading Zeroes and Trailing spaces
 Login/Join
 
Member
posted
Hi,

I need to remove leading zeroes and trailing spaces.

I am able to remove leading zeroes using this function, but when I try to nest it with another trim, I get error.

please help.

Input: IDOCNUMBER = 000000000123456789
Expression to remove leading zeroes - TRIM( 'L', IDOCNUMBER, 50, '0', 1, 'A50' )
Output - 123456789

Now I want to remove trailing spaces. I tried to do RTRIM(TRIM( 'L', IDOCNUMBER, 50, '0', 1, 'A50' )) or TRIM(TRIM( 'L', IDOCNUMBER, 50, '0', 1, 'A50' )) since the default is spaces, but nothing worked Frowner

This message has been edited. Last edited by: Kerry,
 
Posts: 23 | Registered: April 21, 2008Report This Post
Expert
posted Hide Post
This is a data field, not a Dialogue Manager variable?

May I ask why you need to remove trailing spaces?


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
Member
posted Hide Post
this is a data field in my process flow that I created in datamigrator.

why I need to remove trailing spaces --> thats how I am required to do and copy to target system.
 
Posts: 23 | Registered: April 21, 2008Report This Post
Expert
posted Hide Post
Are there really trailing spaces, or is this a 50 character field? Wouldn't there always be 50 characters in a 50 character field? To determine the length of the non-blank part of a field, use the ARGLEN function.


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
Member
posted Hide Post
The max length for this field is 50, but there will not be 50 characters in them always.. there might be spaces too Frowner

So if I am understanding right, ARGLEN will just give me the length of the characters excluding spaces is it?
 
Posts: 23 | Registered: April 21, 2008Report This Post
Expert
posted Hide Post
I don't understand why your DataMigrator process can't simply move the field from one table to the other? Why do you need to remove spaces?


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
Member
posted Hide Post
thats my requirement :-)

when moving from source to target, I need to remove extra spaces.
 
Posts: 23 | Registered: April 21, 2008Report This Post
Virtuoso
posted Hide Post
This will remove trailing spaces, but if you put the resulting string back into an A50 field, it will be padded with spaces/blanks to fill out the 50 characters:
TRIM('R',IDOCNUMBER,50,' ',1,'A50')

You could try putting the TRIMmed value into a variable length field:
TRIM('R',IDOCNUMBER,50,' ',1,'A50V')

Or, if writing the value to a HOLD file, you could specify the exact, non-blank length by using function ARGLEN as suggested by Francis:
DEFINE FILE <filename>
 OUTLENGTH/I5  = ARGLEN(50,IDOCNUMBER,'I5');
 OUTFORMAT/A10 = 'A' | EDIT(OUTLENGTH);
END

TABLE FILE <filename?
 PRINT IDOCNUMBER/OUTFORMAT
 .
 ON TABLE HOLD
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Member
posted Hide Post
Thanks Dan.

About this HOLD file, is this code I need to write and cannot use the synonym generator? Frowner

Can I have nested TRIM?

Reason being, I need to TRIM leading zeroes from the data as well.
 
Posts: 23 | Registered: April 21, 2008Report This Post
Guru
posted Hide Post
Anything FOCUS programmer puts in a DEFINE you could also put in a tranformation in DataMightor. Including nested function calls.


N/A
 
Posts: 397 | Location: New York City | Registered: May 03, 2007Report This Post
Virtuoso
posted Hide Post
You can use TRIM to remove leading zeroes, but Francis' earlier comment is valid: you shouldn't need to remove trailing blanks because DataMigrator should automatically take care of truncating data from your source column when loading it into a smaller target column.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
<JG>
posted
Silly question but what DB is the DM target? and what format is the target column?

Create the transfer file as COM or TAB and it will automatically truncate trailing spaces.
 
Report This Post
Member
posted Hide Post
Thanks Dan, JG.

I am using TRIM( 'L', IDOCNUMBER, 50, '0', 1, 'A50V' ) where IDOCNUMBER is the source column name.

Since outformat is A50V, though it removes leaading zeroes, it pads up spaces for the remaining characters in the output string.. thus has spaces.
 
Posts: 23 | Registered: April 21, 2008Report This Post
<JG>
posted
look at the adapter documentation

for example ENGINE SQLORA SET VARCHAR ON/OFF
 
Report 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] Remove Leading Zeroes and Trailing spaces

Copyright © 1996-2020 Information Builders