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     Concatenating row data

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Concatenating row data
 Login/Join
 
Member
posted
I am trying to multiple rows of a text column for output into a file that a user will use to load a memo field in a table. The data is simple, record ID (A8) and comments (A1 -A255). The end result I am looking for is one comments field (A3000) per record id so that all the individual comment rows are concatenated together.
Current:
RecID Comments
11111111 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
11111111 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
11111111 cccccccccccccccccccccccccccccccccc
22222222 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
22222222 ******************************

Desired:
RecID Comments
11111111 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbb bbbbbbbbbbbbbbbbbbbb ccccccccccccccccccc
22222222 hhhhhhhhhhhhhhhhhhhhhhhhhhhhhh *********k
***************************************kk

I have tried one the techniques from similar posts:
NEWFIELD/A3000 = IF RECID EQ LAST RECID THEN SUBSTR(255, NEWFIELD 55,’A255’) || ( ‘’ | COMMENTS) ELSE COMMENTS
But I only seem to return the first and last comment rows in the new field.
Thanks


WebFOCUS 7.1.3
Windows XP
 
Posts: 4 | Registered: June 03, 2008Report This Post
Expert
posted Hide Post
Your're not concatenating COMMENTS to previous COMMENTS, you're wiping them out with the code as shown. Note that your data has to be in the correct order for the LAST to work.

Here's a working example using the CAR file:

SET HOLDFORMAT = ALPHA
SET ASNAMES = ON
SET HOLDLIST = PRINTONLY
-RUN

TABLE FILE CAR
PRINT
COUNTRY MODEL
BY COUNTRY NOPRINT
BY MODEL NOPRINT
ON TABLE HOLD AS H001
END
-RUN

TABLE FILE H001
SUM
COMPUTE NEWFIELDT/A3000V = 
  IF COUNTRY EQ LAST COUNTRY THEN  NEWFIELD || (' ' | MODEL) ELSE COUNTRY || (' ' | MODEL); NOPRINT
COMPUTE NEWFIELD/A3000 = NEWFIELDT;

BY COUNTRY NOPRINT
ON TABLE HOLD AS H002
END

TABLE FILE H002
PRINT *
END


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
Member
posted Hide Post
Francis,
I am working with your solution and I seem to only get the last comment. For Example
RecID Comments
11111111 cccccccccccccccccccccccc
22222222 ************************

I have verified that the records and comments are in the proper order. It looks like the compute overwrites the value newfieldt each time and dosen't apend through each step of the loop. I really am tring to create a variable and append the value of comments to it until the value of RECID changes. So far no luck.


WebFOCUS 7.1.3
Windows XP
 
Posts: 4 | Registered: June 03, 2008Report This Post
Master
posted Hide Post
Your substring value on NEWSTRING should be 2745. (the size of NEWSTRING 3000, minus the size of COMMENTS 255).


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
The COMPUTE in Francis's second step will list only one MODEL value per COUNTRY (the summed value of the implicit verb object MODEL).

Instead, assemble the list in a DEFINE on the first hold, then hold the last value per country.
TABLE FILE CAR
COUNT ENTRIES BY COUNTRY BY MODEL
ON TABLE HOLD AS H001
END

DEFINE FILE H001
RESULT/A3000V = IF (COUNTRY EQ LAST COUNTRY)
  THEN RESULT   || (' ' | MODEL)
  ELSE COUNTRY  |  (' ' | MODEL);
END

TABLE FILE H001
SUM LST.RESULT/A3000 BY COUNTRY
ON TABLE SET HOLDLIST PRINTONLY
ON TABLE HOLD AS H002
END

TABLE FILE H001
LIST *
END
TABLE FILE H002
LIST *
END


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Member
posted Hide Post
I was able to get my results with Jack's example.
Thanks.


WebFOCUS 7.1.3
Windows XP
 
Posts: 4 | Registered: June 03, 2008Report This Post
Expert
posted Hide Post
Jack, thanks for fixing that code!

Here's mine, slightly tweaked:
SET HOLDFORMAT = ALPHA
SET ASNAMES = ON
SET HOLDLIST = PRINTONLY
-RUN

TABLE FILE CAR
PRINT
COUNTRY MODEL
BY COUNTRY NOPRINT
BY MODEL NOPRINT
ON TABLE HOLD AS H001
END
-RUN

DEFINE FILE H001
NEWFIELDT/A3000V = 
  IF COUNTRY EQ LAST COUNTRY THEN  NEWFIELD || (' - ' | MODEL) ELSE COUNTRY || (': ' | MODEL); NOPRINT
COMPUTE NEWFIELD/A3000 = NEWFIELDT;
END

TABLE FILE H001
SUM
NEWFIELDT/A3000

BY COUNTRY NOPRINT
-*BY MODEL NOPRINT
ON TABLE HOLD AS H002
END

TABLE FILE H002
PRINT *
END


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
Member
posted Hide Post
Thanks for the other approach. I'm starting to figure out how WF works.


WebFOCUS 7.1.3
Windows XP
 
Posts: 4 | Registered: June 03, 2008Report 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     Concatenating row data

Copyright © 1996-2020 Information Builders