Focal Point
[SOLVED] Split a variable to new line header

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

July 12, 2012, 11:57 AM
sladkat
[SOLVED] Split a variable to new line header
Hi,

We have amper variable storing a number of labels separated by '|' . Need to show each label on new line in the header.
For eg. an amper variable like
&label_header = 'canada|germany|us|mexico'

The above variable string should get split and show each country on new line on the header.

"Report"
country: canada
germany
us
mexico

Thanks in advance.

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


Supriya
WF 7.7.02/8.0
July 12, 2012, 12:07 PM
j.gross
Use the GETTOK() function.
July 12, 2012, 01:18 PM
Dan Satchell
If the text will be used in a HEADING, this might work. It breaks the text into separate HEADING lines by replacing each | character with a set of double quotes separated by a carriage return.

In effect, canada|germany|us|mexico becomes

canada"
"germany"
"us"
"mexico

-SET &LABEL_HEADER = 'canada|germany|us|mexico';
-SET &NEW_LINE     = '"' | HEXBYT(13,'A1') | '"';
-SET &OUT_LENGTH   = &LABEL_HEADER.LENGTH + 50 ;
-SET &LABEL_BREAK  = STRREP(&LABEL_HEADER.LENGTH,&LABEL_HEADER,1,'|',3,&NEW_LINE,&OUT_LENGTH,'A&OUT_LENGTH.EVAL');
-*
TABLE FILE CAR
 HEADING
  "Country: &LABEL_BREAK"
 PRINT COUNTRY AS ''
END



WebFOCUS 7.7.05
July 12, 2012, 06:08 PM
Waz
A variation on Dans suggestion is multiplatform.

-SET &LABEL_HEADER = 'canada|germany|us|mexico';
-SET &OUT_LENGTH   = &LABEL_HEADER.LENGTH + 50 ;
-SET &LABEL_BREAK  = STRREP(&LABEL_HEADER.LENGTH,&LABEL_HEADER,1,'|',4,'</1>',&OUT_LENGTH,'A&OUT_LENGTH.EVAL');

TABLE FILE CAR
 HEADING
  "Country: &LABEL_BREAK"
 PRINT COUNTRY AS ''
END



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!

July 13, 2012, 04:34 AM
Dave
This will work to:

-SET &LABEL_HEADER = 'canada </1 germany </1 us </1 mexico';

TABLE FILE CAR
  SUM SALES
  BY COUNTRY
HEADING
"&LABEL_HEADER"
END


Just replace the | with </1 and you're done.


Greets,D


_____________________
WF: 8.0.0.9 > going 8.2.0.5
July 18, 2012, 01:46 AM
sladkat
Thnaks a lot. Smiler


Supriya
WF 7.7.02/8.0