Focal Point
[CLOSED] Break column data by value

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

July 26, 2011, 01:54 PM
Carlos Dias
[CLOSED] Break column data by value
I want to break the data of a column by value.

Suppose that in my report I have:

------------------------
ColName |
------------------------
value1, value2, value3 |
------------------------
value1, value2 |
------------------------

I want to break the data by the semicolon. Something like these:

-----------------
ColName |
-----------------
value1, |
value2, |
value3 |
-----------------
value1, |
value2 |
-----------------

Thanks,
Carlos Dias

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


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
July 26, 2011, 04:49 PM
Rafael.AZ
I'm not sure I get what you try to achieve, but i could be using multiple BY clauses?
or you can try to use the ACROSS clause which will sort of transpose your data, if you post an actual example it will be easier to help.


WebFocus 768
Windows, all output
July 26, 2011, 06:13 PM
Waz
If you want to split the values in the column into rows, then you will need to use the Macgyver technique.

There are many examples on the forum.


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 27, 2011, 02:24 AM
Ramkumar - Webfous
Are you trying to Split the Data (Not entire Row... But a single Data, column value) using a Delimiter? Or something else ?


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
July 27, 2011, 04:38 AM
Carlos Dias
Ramkumar you are right I'm trying to split the data.

I want to transform this (the "ColName1"):


In


Thanks,
Carlos Dias


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
July 27, 2011, 05:44 PM
Waz
Here is an example that does what I think you want.

-* Write out a master to read the TST_DATA list
EX -LINES 5 EDAPUT MASTER,TST_DATA,CV,FILE
FILENAME=TST_DATA, SUFFIX=FIX,$
SEGNAME=TST_DATA, $
  FIELD=ColName2 ,ALIAS=  ,A3 ,A3 ,$
  FIELD=ColName1 ,ALIAS=  ,A50 ,A50 ,$


EX -LINES 4 EDAPUT FOCTEMP,TST_DATA,CV,FILE
123abc1, abc2, abc3, abc4
456abc1, abc2, abc3
789abc1, abc2

FILEDEF TST_DATA DISK tst_data.ftm (LRECL 80 RECFM V

-RUN


EX -LINES 7 EDAPUT MASTER,fseq,CV,FILE
 FILE=FSEQ, SUFFIX=FIX
  SEGNAME=SEG1
   FIELD=CONTROL, BLANK , A1, A1, $
  SEGNAME=SEG2, PARENT=SEG1, OCCURS=VARIABLE
   FIELD=WHATEVER, , A1, A1, $
   FIELD=COUNTER, ORDER, I4,  I4,$

FILEDEF FSEQ DISK fseq.mas (LRECL 1000

TABLE FILE FSEQ 
PRINT COUNTER
BY    CONTROL
WHERE RECORDLIMIT EQ 10
ON TABLE HOLD AS FOC_FSEQ FORMAT FOCUS INDEX CONTROL
END

JOIN BLANK WITH ColName2 IN TST_DATA TO ALL CONTROL IN FOC_FSEQ

DEFINE FILE TST_DATA
 BLANK/A1 WITH ColName2 = ' ' ;
END

TABLE FILE TST_DATA
PRINT ColName1
      COMPUTE Item/A5 = LJUST(5,GETTOK(ColName1,50,COUNTER,',',5,'A5'),'A5') ;
BY    ColName2
BY    COUNTER
WHERE TOTAL Item NE ' '
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 27, 2011, 07:38 PM
Carlos Dias
I tried a simpler approach:

DEFINE FILE CAR
STRING/A200='abc1, abc2, abc3, abc4, abc5';
ASTRING/A100V = STRREP(200,STRING,1,',',6,',<br>',100,ASTRING);
END

TABLE FILE CAR
PRINT
COUNTRY
STRING
ASTRING
END


Result:


Using the break HTML works... but I want to break in the second semicolon. So I want something like:
ASTRING
-------------
abc1, abc2,
abc3, abc4,
abc5

Thanks,
Carlos Dias


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
July 28, 2011, 04:16 AM
Tony A
Use style sheet control -

DEFINE FILE CAR
  STRING/A200='abc1, abc2, abc3, abc4, abc5';
END

TABLE FILE CAR
PRINT STRING
   BY COUNTRY
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
  TYPE=REPORT, COLUMN=STRING, WIDTH=0.80, WRAP=0.80, $
ENDSTYLE
END

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 28, 2011, 06:13 AM
Carlos Dias
Nice approach Tony but unfortunately doesn't work in AHTML style.

Thanks,
Carlos Dias


WebFOCUS version: 7.6
Linux/Windows
HTML, Excel
July 28, 2011, 06:38 AM
Tony A
quote:
unfortunately doesn't work in AHTML style.

But then I do not see any mention of an AHTML requirement Confused

However, if you include the ON TABLE SET HTMLCSS ON then it does.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 28, 2011, 04:34 PM
H8K
Have you tried ACCORDIAN REPORTS?