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     Appending to an Alpha field over multiple records

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Appending to an Alpha field over multiple records
 Login/Join
 
Platinum Member
posted
Hi,

I need to read through some records which have been previously selected and reside in a hold file TEST. Where the DATE_TIME field is the same I need to append the field NOTES together to create a new field ALL_NOTES. I will then be able to select the last record created and use this in my report and it should contain the whole note.

Example of my file TEST:
REC_NUMBER(P10)
DATE_TIME(A12)
NOTES(A30)

REC_NUMBER DATE_TIME NOTES
1 01MAR061000 The Customer has requested tha
2 01MAR061000 t the goods be dispatched Tuesday.

So I need to concat the notes fields together so I can eventually report them on one line: "The Customer has requested that the goods be dispatched Tuesday"

I looked through the online help and found an example using LAST and have coded it as follows

TABLE FILE TEST
PRINT
REC_NUMBER
DATE_TIME
COMPUTE ALL_NOTES/A800 = IF DATE_TIME EQ LAST DATE_TIME THEN
(ALL_NOTES || NOTES) ELSE NOTES; AS 'All Notes'

END

However this gives me the error:

RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: ALL_NOTES

So it does not like me trying to concat the NOTES field to ALL_NOTES. If I change the expression to compute a Total REC_NUMBER using numerics and adding the REC_NUMBER together it works just fine.

Hope this is all clear and someone can help.

Many thanks

Mark.


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Platinum Member
posted Hide Post
Hi Mark,

I think the problem lies in the fact A800 is not accepted , i'm not sure but i think it goes up to A256 , try using A800V -> goes up until A4096V

Hope it helps

P.

quote:
TABLE FILE TEST
PRINT
REC_NUMBER
DATE_TIME
COMPUTE ALL_NOTES/A800V = IF DATE_TIME EQ LAST DATE_TIME THEN
(ALL_NOTES || NOTES) ELSE NOTES; AS 'All Notes'

END


D: WF 7.6.2 P. : WF 7.6.2 on W2003
------------------------------------------------------------------
I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.

-Jim Morrison-

 
Posts: 206 | Registered: February 25, 2005Report This Post
Expert
posted Hide Post
Hi Mark,

The reason you are getting the error is that you are trying to concatenate strings of length 800 plus the length of the field NOTES into a declared string of length 800. You will have to derive a method of reducing the ALL_NOTES field before appending it.

Try using something like SUBSTR combined with ARGLEN -

TABLE FILE GGSALES
SUM COMPUTE ST_STRING/A800 = IF ST NE LAST ST 
THEN SUBSTR(800, LAST ST_STRING, 1, ARGLEN(800, ST_STRING, 'I4'), 
ARGLEN(800, ST_STRING, 'I4'), 'A600') || ST ELSE LAST ST_STRING;
BY ST
END


Note that I have split the code line to fit on the screen, so you will have to adjust it.
Also note that the final argument for SUBSTR is less than the A800 of the parent string, this is to prevent the FOC282 error.

Alternatively, use the A800V format as suggested by Pete.

T

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, 2004Report This Post
Platinum Member
posted Hide Post
Brilliant, thanks guys. Pete's suggestions of using 800V worked straight awat.

By the way, what type is 'V' ? Sorry I am very new to WebFocus!


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Platinum Member
posted Hide Post
Mark,

I think its refers to varchar types

P.


D: WF 7.6.2 P. : WF 7.6.2 on W2003
------------------------------------------------------------------
I see myself as an intelligent, sensitive human, with the soul of a clown which forces me to blow it at the most important moments.

-Jim Morrison-

 
Posts: 206 | Registered: February 25, 2005Report This Post
Expert
posted Hide Post
Forgot about the varchar data-type.

This old-fashioned way, using SUBSTR works as well:

TABLE FILE CAR
SUM CAR
BY COUNTRY
BY CAR NOPRINT
ON TABLE HOLD
END

TABLE FILE HOLD
PRINT
COMPUTE CARS/A1000 = IF COUNTRY EQ LAST COUNTRY THEN SUBSTR(1000, CARS, 1, 900, 900, 'A900') || (' / ' | CAR) ELSE CAR;
BY COUNTRY
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF,
FONT='ARIAL', SIZE=8, $
ENDSTYLE
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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Appending to an Alpha field over multiple records

Copyright © 1996-2020 Information Builders