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     [SOLVED] DATETRAN for 'MYY'

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] DATETRAN for 'MYY'
 Login/Join
 
Member
posted
I do not understand how the IBI 'DATE' format works.
I'm dealing with a masterfile where the date is DATE format with a USAGE of YY-M-D.

FIELDNAME=DEPARTUREDATE, ALIAS=calendarDate, USAGE=YY-M-D, ACTUAL=DATE,
TITLE='Departure Date', $

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
END

This 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, 2008Report This Post
Expert
posted Hide Post
I would suggest putting in case with IBI to get this fixed.

It certianly looks like a Bug.


Also if you are converting to Dutch, the month names do not work for 7.6.4 or 7.6.5. Don't know about later versions.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Judy,

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:
  
FIELDNAME=DEPARTUREDATE, ALIAS=calendarDate, USAGE=YY-M-D, ACTUAL=DATE,
TITLE='Departure Date', $
FIELDNAME=DEPARTUREMONTH, ALIAS=calendarDate, USAGE=YYM, ACTUAL=DATE,
TITLE='Departure Date', $

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, 2006Report This Post
Virtuoso
posted Hide Post
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, 2007Report This Post
Member
posted Hide Post
Thank you for your replies. [SOLVED]


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, 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     [SOLVED] DATETRAN for 'MYY'

Copyright © 1996-2020 Information Builders