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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Removing Leading spaces from the Column Data

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Removing Leading spaces from the Column Data
 Login/Join
 
Gold member
posted
Hi All,

I got stuck in a problem.
I have one column data as
"1. Some string Data Here"

Now I want to remove the 1. and space after it. OR just the space between 1. and String.

that my output should be like this
"Some string Data Here" OR
"1Some string Data Here"


My Report output format is TABT(Text) format

I have tried STRREP and TRIM with Left but not able to remove the space
Here is the code

STRREP used
 
WORK_UNIT_NAME/A302=STRREP(303,WORK_UNIT_NAME,2,'1.',0,'X',302,WORK_UNIT_NAME);
 



Here is TRIM I used
 
WORK_UNIT_NAME/A301=TRIM('L',WORK_UNIT_NAME,301,' ',0,WORK_UNIT_NAME);



This two lines I have used in the Define,
and I am not able to use TRUNCATE in Define.

Please suggest me something
Any help would be highly appreciated .

Thanks.
Anmol.

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


WebFocus7.6.2, WebFocus 7.1.1,Windows
HTML, PDF and Excel
 
Posts: 71 | Registered: June 30, 2009Report This Post
Virtuoso
posted Hide Post
I think you can do that with GETTOK looking for the second token separated by a dot. And then do a left justify of the data.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
Example in DM:
-SET &TEXT = '1. Some string data here' ;
-TYPE &TEXT
-SET &TEXT2=LJUST(&TEXT.LENGTH,GETTOK(&TEXT, &TEXT.LENGTH, 2, '.', &TEXT.LENGTH, 'A&TEXT.LENGTH'), 'A&TEXT.LENGTH');
-TYPE &TEXT2

You can do this in DEFINE also of course.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
There are several things wrong with your code.

1) Do not name the virtual column the same as the real column, if you do and if there is an error in the function call, the report will still run, but with the real column.

e.g.:

DEFINE FILE CAR
COUNTRYX/A301 = '1. ' | COUNTRY;
COUNTRYX/A301=TRIM('L',COUNTRYX,301,' ',0,COUNTRYX);
END
TABLE FILE CAR
PRINT
COUNTRYX
END
Even though there is an error here, the report still runs. To see the error, change the code to:
DEFINE FILE CAR
COUNTRYX/A301 = '1. ' | COUNTRY;
COUNTRYY/A301=TRIM('L',COUNTRYX,301,' ',0,COUNTRYY);
END
TABLE FILE CAR
PRINT
COUNTRYX
COUNTRYY
END

2) Syntax error in the TRIM call - the "pattern_length" cannot be 0.

3) This STRREP should work:
WORK_UNIT_NAMEX/A303 = STRREP(303, WORK_UNIT_NAME, 3, '1. ', 0, 'X', 303,'A303');

4) If you know that you need to remove the first three characters, use the SUBSTR function:
-*                     SUBSTR(inlength, parent, start, end, sublength, outfield);
WORK_UNIT_NAMEX/A300 = SUBSTR(301, WORK_UNIT_NAME, 4, 301, 300, 'A300');


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
As I said in your other post.
http://forums.informationbuild...237020006#2237020006


Use LJUST.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Hi All,
Thanks for all the suggestions and sorry for the late reply..
I am able to work out for the solution using CTRAN function.

Followign line works for me..
 WORK_UNIT_NAMEX/A303 = CTRAN(303, WORK_UNIT_NAME, 9, 32, WORK_UNIT_NAME); 



Thanks a lot..

Regards,
Anmol


WebFocus7.6.2, WebFocus 7.1.1,Windows
HTML, PDF and Excel
 
Posts: 71 | Registered: June 30, 2009Report 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 Leading spaces from the Column Data

Copyright © 1996-2020 Information Builders