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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Concatenate multiple occurrences of a field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Concatenate multiple occurrences of a field
 Login/Join
 
Silver Member
posted
I am doing a query to get data fields to put together as a message table. The data in the table would have message number, line number, and text. I am getting the data out of the table but then want to concatenate the text by message number and line number into 1 field. For example:

message number line number text
1 1 This is the
1 2 first paragraph
1 3 of information.
2 1 This is the
2 2 second paragraph.

What I want in the end is to be able to create a table that has 2 rows:
This is the first paragraph of information.
This is the second paragraph.

I could have multiple message numbers and multiple line numbers within what I'm getting back from db2. Can anyone help with how I can accomplish this?

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.1.04
Windows, All Outputs
 
Posts: 34 | Registered: July 02, 2014Report This Post
Expert
posted Hide Post
Here is a working example.

I first create a data file to simulate your db2 table. Then I create a Master for the file. The first TABLE FILE.. HOLD ensures that the data rows are in the correct order. The DEFINE FILE concatenates the multiple occurrences, the TABLE FILE... SUM outputs the paragraphs.


FILEDEF MY_DB2_TABLE DISK my_db2_table.txt
-RUN

-WRITE MY_DB2_TABLE 1 1 This is the
-WRITE MY_DB2_TABLE 1 2 first paragraph
-WRITE MY_DB2_TABLE 1 3 of information.
-WRITE MY_DB2_TABLE 2 1 This is the
-WRITE MY_DB2_TABLE 2 2 second paragraph.

FILEDEF MASTER DISK my_db2_table.mas
-RUN

-WRITE MASTER FILENAME=MY_DB2_TABLE, SUFFIX=FIX, $
-WRITE MASTER SEGNAME=MY_DB2_TABLE, $
-WRITE MASTER FIELDNAME=MESSAGE_NUMBER, FORMAT=I1 , ACTUAL=A1 , $
-WRITE MASTER FIELDNAME=FILL1         , FORMAT=A1 , ACTUAL=A1 , $
-WRITE MASTER FIELDNAME=LINE_NUMBER   , FORMAT=I1 , ACTUAL=A1 , $
-WRITE MASTER FIELDNAME=FILL2         , FORMAT=A1 , ACTUAL=A1 , $
-WRITE MASTER FIELDNAME=MESSAGE_TEXT  , FORMAT=A20, ACTUAL=A20, $

TABLE FILE MY_DB2_TABLE
PRINT
MESSAGE_TEXT

BY MESSAGE_NUMBER
BY LINE_NUMBER
ON TABLE HOLD AS HOLD001
END
-RUN

DEFINE FILE HOLD001
MESSAGE_TEXT_OUT/A500V = IF MESSAGE_NUMBER EQ LAST MESSAGE_NUMBER THEN MESSAGE_TEXT_OUT || (' ' | MESSAGE_TEXT) ELSE MESSAGE_TEXT;
END
-RUN

TABLE FILE HOLD001
SUM
MESSAGE_TEXT_OUT
BY MESSAGE_NUMBER NOPRINT
END
-RUN


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
Silver Member
posted Hide Post
Thank you Francis! This gives me exactly what I need.


WebFOCUS 8.1.04
Windows, All Outputs
 
Posts: 34 | Registered: July 02, 2014Report 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     [SOLVED] Concatenate multiple occurrences of a field

Copyright © 1996-2020 Information Builders