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 have never worked with a language that makes formatting a date so ridiculously difficult. I usually end up spending less time on an entire report than I do just formatting a date.
After spending literally all morning trying to convert a date, I finally ended up doing a define in the masterfile and using a DB_EXPR with a to_char against the date in the database. Took me all of 10 seconds.This message has been edited. Last edited by: Kris,
Well, I don't want anyone to get hurt... but I understand where you are coming from. Dates are pretty perplexing in WebFOCUS.
What exactly were you trying to do? I've suffered with WebFOCUS dates for a while now and I can probably get you an example of something you are looking for.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
I'm sorry you had a frustrating experience with dates. Have you taken a look at our documentation on date formatting? For a starter you can check out our Using Functions guide.
If you can provide more detail on the exact problem you were having, we can help you figure out what to do.
I've been in the game for about 20 years and I have to say that date manipulation in WebFOCUS can be quite frustrating. Have you taken a good look at the syntax for the function DATETRAN? Why is this the only function that requires quotes AND brackets for some (but not all) of the parameters? I could probably pick apart a few other date/date-time functions.
Kris, let us know of your requirement - I'm sure we can help.
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
SO, someone realized that it IS frustrating to use date/date-time functions and created new ones. I certainly hope that these new functions COMPLETELY replace the old ones and can be used in WebFOCUS AND Dialogue Manager code. Otherwise we have a bigger mess.
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
I must be on the outside looking in on this one. In my 20+ years of Focus/WebFOCUS, I've never had any trouble with dates and date functions. I guess I've just been lucky.
That being said, these days I do lean to the DB_EXPR function for 90% of my date work. I do this almost entirely because of performance and throughput.
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
Originally posted by dhagen: In my 20+ years of Focus/WebFOCUS, I've never had any trouble with dates and date functions.
I have a 200+ page book dedicated EXCLUSIVELY to WebFOCUS date usage, and I still struggle. For me, the syntax is strange and it is impossible for me to memorize it.
Then there are several date types that usually end up having to be converted to other date types. And date functions embedded in other date functions. It gets very confusing.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
I think one of the basic causes of this lack of understanding of WF dates, is that most people are familiar with SQL dates.
WebFOCUS need to support SQL (and its different flavours) and the 300+ other data sources.
IF a date is stored/read into or converted into a smartdate, then all is very simple.
Datetime are a little bit more interesting to play with.
But to all out there, RTFM (Read The Functions Manual), do a search of the forum and get a copy of the "(Almost) 1001 Ways to Work With Dates in WebFOCUS" book.
As long as you understand what the format is and if its DM or not, no problems
Totally agree with this Waz and also with Francis, experience is often the key.
The main misunderstanding I see is that there are many inexperienced folks who think that 20161115 is a date. They get disheartened when you tell them that it isn't a date but an integer value which we humans interpret as a date!
T
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
Originally posted by Waz: But to all out there, RTFM (Read The Functions Manual), do a search of the forum and get a copy of the "(Almost) 1001 Ways to Work With Dates in WebFOCUS" book.
I own the "(Almost) 1001 Ways to Work With Dates in The Tower of Babel." It was a fine effort at making sense of WebFOCUS dates, but it's a little like putting lipstick on a pig.
It's good news, however, that date simplification is starting to happen in the latest releases.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
I own the "(Almost) 1001 Ways to Work With Dates in The Tower of Babel."
I also own the book and it has an overwhelming amount of information, so you never find what your looking for. Luckily I purchased the Version 7 release for only $19.95 and saved on the $100+ for the version 8 one.
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server
Thanks everybody for your replies. I have a date in the database. The date in the masterfile is pulled in the following format YYMD. I need this date in an additional format of Y-Mt. I have tried CHGDAT, EDIT, DATECVT, DATETRAN, DPART, and who remembers what else. I tried pulling the date apart in the masterfile and then concatenating the pieces together in the fex. That didn't quite work either. I could see the year (16) and the month (Nov), but when I tried putting them together I got something on the order of '16-340' (some kind of numeric value rather than the abbreviated month.) I have done searches on this forum, but nothing really looked all that promising. (Btw... why do people automatically assume that if you write something in this forum that you have not done any previous research - ie., looked at the forum or read the documentation?) I have read each of the entries in the documentation about date formatting and editing, and I DO have the book (Almost) 1001 Ways to Work With Dates in WebFOCUS. (BTW, loved your description of this Squatch.) I'm sorry that I am so inept at trying to figure this out, but this post is mostly about my total frustration with the craziness of how WebFocus handles dates and my inability to once and for all figure out when and how to use these different functions. Having to go through 3 or 4 conversions of a date to finally get to the format you need/want seems like a lot of work for such little return. I guess it is too bad that I don't have 8.1.0.8 which has some simpler formatting techniques.
I still am trying to get this to work, the DB_EXPR is giving me some kind of error message, so it is back to the drawing board and another day of trying to figure out how to do something that should be relatively simple. Believe me when I say that figuring out how to format dates in this language takes up the majority of my time when trying to format a report. If I didn't need to deal with dates, I could whip out a report in no time. A lot of times when I run into this problem, I dump the masterfile and pull everything in a sql passthru. However, I am just enhancing an already existing report rather than writing it from scratch.
Thanks for listening. And if you find that magical conversion combination between 'yyymd' and 'Y-Mt' pass it along.
Oh and btw... I really appreciate the fact that I'm not the only one frustrated with dates. Thanks again guys for your responses - it helps to know that other people have had problems with dates. Totally am amazed at the knowledge and quality of people on this forum.
Kris, Your problem is the dash in 'Y-Mt'. Without it, it is simple: Say your date is KDATE/YYMD. Simply
DEFINE FILE fff
MDATE/YMT=KDATE;
END
However, you want to insert a '-' and do away with the space. Here is a possiblility:
DEFINE FILE CAR
KDATE/A6YMD='&YMD';
MDATE/A4YM=EDIT(KDATE,'9999');
QDATE/A12=EDIT(FPRINT(MDATE, 'A4YMT', 'A12'),'99-$999');
END
TABLE FILE CAR
PRINT COUNTRY MDATE QDATE
END
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
If I understand your requirements correctly: Your incoming data is an Oracle DATE-TIME, and you need to reformat the data into YY-Mt.
Can you try to redefine your incoming Oracle date to a DATE-TIME field with the format that meets your requirements?This message has been edited. Last edited by: David Briars,
That "intype" really isn't an 'input type' - it looks like it's used to specify which date components you want in the output. "-t" seems to provide Y-Mt.
Does the 1001 Spells for Sorcerers book have examples for DATETRAN?
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
Originally posted by Francis Mariani: ...Does the 1001 Spells for Sorcerers book have examples for DATETRAN?
Not that I can see. The Third Edition 2011 Spell book has an incantation for it starting near the bottom of page 23, which just defines it. The chanting spills over to the top of page 25.
(It seems to not only be missing a closing apostrophe for intype, but the complete outformat as well. The Spell fails!)
The intype appears to describe the input SmartDate fieldname, but instead seems to be related to the output as you have noted. The outtype is defined as "specify options for leading zeroes, month and delimiters."
Instead of intype and outtype, it probably should say outtype and format options.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015
I own the "(Almost) 1001 Ways to Work With Dates in The Tower of Babel."
I also own the book and it has an overwhelming amount of information, so you never find what your looking for. Luckily I purchased the Version 7 release for only $19.95 and saved on the $100+ for the version 8 one.
I could have written your words verbatim to express my feelings. That is EXACTLY how I feel. It is easy to find the right chapter for what you want to do, but it gets kind of foggy and hazy after that.
Unfortunately, I paid full price.
App Studio WebFOCUS 8.1.05M Windows, All Outputs
Posts: 594 | Location: Michigan | Registered: September 04, 2015