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.
I want to use the DATETRAN function to format it in different ways in different langauges. The format and language will be passed in as variables. Sometimes I will display the full date (different combinations of DMY), and othertimes I will display only the month (different combinations of MY).
The code below illustrates my problem. I was hoping to use the one DEPARTUREDATE. To my dismay, DATE2 is not correct when I used DEPARTUREDATE with '(MYY)'.
Why? It seems I have to redefine the DEPARTUREDATE into a new field of YYM before I can use '(MYY)' in the DATETRAN. Shouldn't the date be stored internally the same way, regardless of how I want to print it out?
I'm trying to understand this as I need to suggest how we are going to handle this in all of our reports. Do I really have to add the extra logic to redefine the date to something like MYY if there is not a D in the format? Or is there something I can do in the masterfile to avoid this extra step?
DEFINE FILE CAR DEPARTUREDATE/YYMD = '2009-01-15'; DATE1/A20 = DATETRAN(DEPARTUREDATE,'(DMY)','(-dt)','EN',20,'A20'); -*Incorrect DATE2/A8 = DATETRAN(DEPARTUREDATE,'(MYY)','(-t)','EN',8,'A8'); -*Extra step needed to display as month and year DEPARTUREMONTH/YYM = DEPARTUREDATE; DATE3/A8 = DATETRAN(DEPARTUREMONTH,'(MYY)','(-t)','EN',8,'A8'); END TABLE FILE CAR PRINT COUNTRY DATE1 DATE2 DATE3 ENDThis message has been edited. Last edited by: Kerry,
Judy Miller Software Engr, Decision Support Prism Group, Inc. Email: judy@prism-grp.com
WebFOCUS 7.6.9 Windows XP Output: PDF, Excel, COMT
Posts: 18 | Location: Colorado Springs, CO | Registered: January 23, 2008
Usually, if you have a DATE formatted column, you don't have to use any functions to change the format - you should be able to change the format in the TABLE FILE PRINT/SUM:
DEFINE FILE CAR
DEPARTUREDATE/YYMD = '2009-01-15';
END
TABLE FILE CAR
PRINT
COUNTRY
DEPARTUREDATE
DEPARTUREDATE/YYM
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
As you know, Focus dates are stored as the number of days since 01/01/1901.
However, when you have a date of the form year-month, then, if I am not mistaken, the date is stored as the number of months since 01/1901. Hence your (strange) result.
If your master file maps an RDBMS table, then I suggest you try the following:
By the way, do you have to create multilingual reports from a single database? If so, we have a lot of experience on this side of the world which I can share, if you wish.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006
The documentation for DATETRAN is confusing. It says the second parameter defines the input format, but in fact it defines the output format. Since there is no parameter to describe the input format, I suspect the input must already be in a format compatible with the requested output. In your case, if you want MYY output, the input may need to be in some form of year-month or month-year, as you discovered. And as Waz suggested, it might be worth the trouble of opening a case to see what IBI has to say about it.This message has been edited. Last edited by: Dan Satchell,
WebFOCUS 7.7.05
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007