Focal Point
[SOLVED] CELLS MERGE

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

May 11, 2010, 05:26 AM
YazidYSL
[SOLVED] CELLS MERGE
hello
I would like to know how to merge Excel lines with newlines if it is the same key.
Thank for all.

DEFINE FILE RESERV
LG_4CMD/A800 = IF ITEM2 EQ LAST THEN SUBSTR(800, LG_4CMD, 1, 400, 400, 'A400') || CHAMP ELSE CHAMP || '
';
END

TABLE FILE RESERV
LG_4CMD AS 'Liste des Cmdes magasin'
ON TABLE HOLD AS TAB_FINA FORMAT HTMTABLE
END

SET HTMLFORMTYPE=XLS
-*-SET HTM
-RUN
-HTMLFORM BEGIN





!IBI.FIL.TAB_FINA;

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


WebFOCUS 7.6.9
Windows
(Excel, HTML, PDF)
May 11, 2010, 07:04 AM
Dan Satchell
I see a couple of issues with your code:

1. Your DEFINE syntax is not quite correct.
2. You are missing a verb (PRINT, SUM) in your TABLE request.
3. Using a DEFINE assumes the data is already sorted in proper order; if not, you should sort the data in your TABLE request and use a COMPUTE instead of a DEFINE.
4. Using a variable length field (A800V) with hard concatenation (||) is simpler and safer than using function SUBSTR, unless you use function ARGLEN in conjunction with SUBSTR.

Your code should probably look more like this:

TABLE FILE RESERV
 PRINT
 COMPUTE LG_4CMD/A800V = IF ITEM2 EQ LAST ITEM2 THEN (LG_4CMD || (' ' | CHAMP)) ELSE CHAMP ; AS 'Liste des Cmdes magasin'
 BY ITEM2 NOPRINT
 BY CHAMP NOPRINT
 ON TABLE HOLD AS TAB_FINA FORMAT HTMTABLE
END
.
.
.



WebFOCUS 7.7.05
May 15, 2010, 05:38 AM
Ram Prasad E
Are you looking for something like this?
TABLE FILE CAR
BY COUNTRY
BY CAR
ON TABLE HOLD
END

DEFINE FILE HOLD
CAR_CON/A400V=IF COUNTRY EQ LAST COUNTRY THEN (CAR_C|| (' ' | CAR))  ELSE CAR;
END
TABLE FILE HOLD
SUM
LST.CAR_CON AS 'Car Concatenated'
BY COUNTRY  AS 'Country'
END



WebFOCUS 8.1.05
Windows
http://ibiwebfocus.wordpress.com
https://www.facebook.com/groups/ibi.webfocus/
May 17, 2010, 09:50 AM
GamP
I think this may be helpful:
DEFINE FILE CAR
CR/A1=HEXBYT(10,CR);
TESTSTR/A200V = IF COUNTRY EQ LAST COUNTRY THEN
                TESTSTR || CR || CAR ELSE CAR;
END
TABLE FILE CAR
PRINT TESTSTR
ON TABLE PCHOLD FORMAT EXL2K
END
Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
May 17, 2010, 10:31 AM
YazidYSL
Hello,
Yes it works is fantastic,
thank you for all.


WebFOCUS 7.6.9
Windows
(Excel, HTML, PDF)