Focal Point
How to remove trailing blank spaces?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7751058331

April 29, 2005, 03:46 PM
<new2focus>
How to remove trailing blank spaces?
-DEFAULT &cntry='';
TABLE FILE CAR
PRINT COUNTRY CAR
ON TABLE SAVE AS CARHLD
END
-RUN
-SET &NBR = &LINES;
-REPEAT L_LOOP1 &NBR TIMES
-READ CARHLD NOCLOSE &CTR.10. &CAR.16.

-SET &cntry=&CTR
-*How can I remove the trailing blank spaces from the &cntry variable here? I tried TRIM with no success!
-L_LOOP1
END
April 29, 2005, 03:51 PM
Francis Mariani
This depends on what you want to do with &cntry.
April 29, 2005, 05:32 PM
<new2focus>
&cntry is being displayed on the sub head portion of an included report. The problem is that the subhead style is defined with underline. So the trailing black spaces generating a trailing line after the value.
April 29, 2005, 05:38 PM
Francis Mariani
If &cntry is on it's own on the SUBHEAD line, you could try:

-SET &cntry = 'England ';
-SET &SUBHEAD1 = '"' || &cntry || '"';

TABLE FILE CAR
PRINT CAR
BY MODEL
ON MODEL SUBHEAD
&SUBHEAD1
" "
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF,
FONT='VERDANA', SIZE=8, $
TYPE=SUBHEAD, LINE=1, STYLE=UNDERLINE, $
ENDSTYLE
END

(In this example, there are many blanks after 'England').
April 29, 2005, 05:53 PM
<JG>
Depends on the version of WebFocus but the truncate function is what you need

-SET &VAR2= TRUNCATE(&VAR1);
April 29, 2005, 06:02 PM
reFOCUSing
Give this a try:

-DEFAULT &CNTRY1='';
TABLE FILE CAR
PRINT COUNTRY CAR
ON TABLE SAVE AS CARHLD
END
-RUN
-SET &NBR = &LINES;
-REPEAT L_LOOP1 &NBR TIMES
-READ CARHLD NOCLOSE &CTR.10. &CAR.16.

-SET &CNTRY1= &CTR;
-SET &LEN = ARGLEN(&CNTRY1.LENGTH,&CNTRY1,'I2');
-SET &CNTRY2=TRIM('B',&CNTRY1,&CNTRY1.LENGTH, ' ', 1, 'A&LEN.EVAL');
-TYPE > &CNTRY1 < &LEN > &CNTRY2 <
-L_LOOP1
END

This message has been edited. Last edited by: <Mabel>,
April 29, 2005, 06:16 PM
<new2focus>
TRUNCATE solved the problem. Thanks for all your help. Have a gr8 weekend!