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.
Let me try to explaine my issue. I want to create a fields in a table file or a define and for each row i want to concatenate in the field the previous value with the current value
For example here is the value I seprate the column by # #1#Ludo #2#Dr Nick #3#Toto
and the result should be 1 Ludo Ludo 2 Dr Nick Ludo Dr Nick 3 Toto Ludo Dr Nick Toto
HOw could I perform a such concatenation
I tried
TABLE FILE TEST
PRINT
FIELD1
COMPUTE RESULT/A200 = IF (RESULT EQ LAST RESULT) THEN FIELD1 ELSE RESULT | FIELD1
END
I know what your problem is but have not thought of a good solution yet. Your problem with doing the concatenation to the LAST field into the same field is that you will get an error because your result of the left-hand side of the equal is too small. So if RESULT is 200 and FIELD1 is 10, then the field you concat into has to be at least 210.
Hmmmm.....
I'm sure someone will think of something. I'll keep trying.
The solution you mentioned in the original post would work if you didn't have the problem with the field size that Ginny mentioned.
The way to solve that issue is to use SUBSTR. Think of it this way: If the final size is 200 and a will do this for 20 records, each adding 10 characters, then I can take 10 characters then first time, 20 the second, etc.
Technically the SUBSTR uses 0 characters the first time and 10 the next since its always a record behind. Using concatenation with the current record gives you what you want. By the way, your if logic changes it back to 10, 20, etc.
TABLE FILE CAR SUM COMPUTE LST_CTRY/A200V = LAST COUNTRY || (' ' | LST_CTRY); COMPUTE THIS_CTRY/A200V = COUNTRY || (' ' | LST_CTRY); BY COUNTRY ON TABLE SET HTMLCSS ON ON TABLE SET PAGE NOLEAD END
and here is the output -
COUNTRY
LST_CTRY
THIS_CTRY
ENGLAND
ENGLAND
FRANCE
ENGLAND
FRANCE ENGLAND
ITALY
FRANCE ENGLAND
ITALY FRANCE ENGLAND
JAPAN
ITALY FRANCE ENGLAND
JAPAN ITALY FRANCE ENGLAND
W GERMANY
JAPAN ITALY FRANCE ENGLAND
W GERMANY JAPAN ITALY FRANCE ENGLAND
T
Finally got the output showing (ish) and I see Alan had the same idea at the same time .....This message has been edited. Last edited by: Tony A,
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
I can get it to work with two passes (this may be because the CAR db is hierarchical, or because the data needs to be previously sorted in the correct order):
TABLE FILE CAR
SUM
CAR NOPRINT
BY COUNTRY
BY CAR
ON TABLE HOLD AS H001
END
DEFINE FILE H001
CARS1/A200V = IF COUNTRY EQ LAST COUNTRY THEN CARS || (' ' | CAR) ELSE CAR;
END
TABLE FILE H001
SUM
CARS1
BY COUNTRY
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
You only have to extrapolate the solution from the previous example -
APP PREPENDPATH IBISAMP
TABLE FILE CAR
SUM COMPUTE LST_CAR/A200V = IF COUNTRY EQ LAST COUNTRY THEN LAST CAR || (', ' | LST_CAR) ELSE ''; NOPRINT
COMPUTE THIS_CAR/A200V = CAR || (', ' | LST_CAR);
BY COUNTRY
BY CAR NOPRINT
ON TABLE SET HTMLCSS ON
ON TABLE SET PAGE NOLEAD
END
As per Francis, to get the final result you will need to hold the output and then get the last value by doing SUM THIS_CAR BY COUNTRY
TThis message has been edited. Last edited by: Tony A,
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
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004
TABLE FILE CAR
SUM
COMPUTE CARCNT/I4=IF COUNTRY NE LAST COUNTRY THEN 1 ELSE CARCNT+1; NOPRINT
COMPUTE CARS1/A200V = IF COUNTRY EQ LAST COUNTRY THEN CARS1 || (', ' | CAR) ELSE CAR;
BY COUNTRY
BY HIGHEST 1 CARCNT NOPRINT
BY CAR NOPRINT
END