Focal Point
[SOLVED] Concatenating the year and month

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

October 29, 2009, 04:07 PM
ani
[SOLVED] Concatenating the year and month
Hi ,

I stuck up in concatinating the year and the month fields.
I do have a filed contains the year and an another field with month.

I need to concatenate it in to a single filed.
Please do let me know your suggestions.



Thanks

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


Webfocus 7.6.8
Windows
PDF & Excel
October 29, 2009, 04:14 PM
Francis Mariani
What are the format of the two fields?


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
October 29, 2009, 04:14 PM
FrankDutch
are this numeric fields?

what did you try




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

October 29, 2009, 05:20 PM
ani
Year field format is yy and month field format is mm.

Thanks


Webfocus 7.6.8
Windows
PDF & Excel
October 29, 2009, 05:25 PM
jimster06
You may wish to consider the use of DEFINE; follow the link in the upper right corner for TechDoc. Or use the help feature in WebFOCUS. Look for 'concatentae' or 'concatentation.'


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
October 29, 2009, 05:28 PM
FrankDutch
so both fields are smartdate fields?

if so did you try just this

NEWDATE/YYM=YEARDATE;




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

October 30, 2009, 12:30 AM
Francis Mariani
quote:
Year field format is yy and month field format is mm.

What is the WebFOCUS format? "mm" is not a valid format.


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
October 30, 2009, 11:16 AM
ani
Hi Francis,

Here is the code that I tried.
I got the year and month.
I am trying to concatenate YEAR and MONTH fields.


-MRNOEDIT BEGIN
TABLE FILE EMPLOYEE
PRINT
HIRE_DATE
-*COMPUTE DATE1/YYMD=HIRE_DATE; NOPRINT
-*COMPUTE DATE_FINAL/YYMD=DATEADD(DATE1,'M',-3);
COMPUTE YEAR/YY=HIRE_DATE;
COMPUTE MONTH/M=HIRE_DATE;
-*COMPUTE YEARMONTH/YYM=YEAR|'/'|MONTH;
END
-MRNOEDIT END


Thanks
Ani


Webfocus 7.6.8
Windows
PDF & Excel
October 30, 2009, 11:33 AM
jimster06
The statement, COMPUTE YEARMONTH/YYM=YEAR|'/'|MONTH, tells WebFOCUS that the variable is a so-called Smart date. It would appear that you want a character string like the following:
YEARMONTH/A7 = YEAR | '/' | MONTH;
Note the difference in format.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
October 30, 2009, 11:51 AM
Tom Flynn
WebFOCUS 101:

  
TABLE FILE EMPLOYEE
PRINT
HIRE_DATE
-*COMPUTE DATE1/YYMD=HIRE_DATE; NOPRINT
-*COMPUTE DATE_FINAL/YYMD=DATEADD(DATE1,'M',-3);
COMPUTE YEAR/YY=HIRE_DATE; 
COMPUTE YEAR1/A4YY = EDIT(YEAR);
COMPUTE MONTH/M=HIRE_DATE; 
COMPUTE MONTH1/A2 = EDIT(MONTH);
COMPUTE YEARMONTH/A7=YEAR1 |'/'| MONTH1;
END



Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
October 30, 2009, 12:31 PM
Darin Lee
or even simpler still (forget about concatenating - just use the date):
TABLE FILE EMPLOYEE
PRINT
HIRE_DATE
COMPUTE NDATE1/YYM=HIRE_DATE;
COMPUTE NDATE2/A6YYM=NDATE1;
COMPUTE NDATE3/A7=EDIT(NDATE2,'9999/99');
END



Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
October 30, 2009, 03:51 PM
ani
Hi Darin,

It worked out thanks.


Thanks & Regards
Ani


Webfocus 7.6.8
Windows
PDF & Excel