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     [CLOSED] Creating a Field YYYYMM to compare with an interger field

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Creating a Field YYYYMM to compare with an interger field
 Login/Join
 
Silver Member
posted
I have searched and have not been able to come up with a way to figure this out.

In a SQL table I have a field that represents YYYYMM format, ie. 200903 but it is an integer not a date. I want to create another field that has the current time, so since it is July the field would be 200907. From there I want to be able to find the difference between the two times, so if the SQL table say 200812 and the current says 200907 then there would be a difference of 7. How can I do that? I tried creating a current year column and month column and then combing them, but that did not work.

Any ideas?


Thanks,
Kerry

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


WebFocus 7.6.4
SQL
HTML and Excel
 
Posts: 49 | Registered: June 06, 2008Report This Post
Expert
posted Hide Post
You need to put the SQL dates into smartdates and then you can do arithmetic on them. Note that the integer fields need to have a date format on them:
DEFINE FILE CAR
BEGDTI/I6YYM=200812;
ENDDTI/I6YYM=200907;
BEGDT/YYM=BEGDTI;
ENDDT/YYM=ENDDTI;
DIFFMO/I4=ENDDT-BEGDT;
END
TABLE FILE CAR
PRINT BEGDTI ENDDTI BEGDT ENDDT DIFFMO
BY COUNTRY
WHERE READLIMIT EQ 1
END

There are probably a number of ways you can do this including using functions. But this example just uses simple equalities.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Silver Member
posted Hide Post
I was able to convert the SQL date...thanks but how do I create a current column that has the current date in it? I want this date to continue to move. So today, it would 200907 but in August, I would want it to be 200908.

Thanks,
Kerry


WebFocus 7.6.4
SQL
HTML and Excel
 
Posts: 49 | Registered: June 06, 2008Report This Post
Expert
posted Hide Post
You could apply the BOM function for both dates and use the DATEDIF function to get the number of months between those two dates.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
The system variable that contains the current date is &YYMD. Here is an updated example.
DEFINE FILE CAR
BEGDTI/I6YYM=200812;
ENDDTI/YYMD=&YYMD;
BEGDT/YYM=BEGDTI;
ENDDT/YYM=ENDDTI;
DIFFMO/I4=ENDDT-BEGDT;
END
TABLE FILE CAR
PRINT BEGDTI ENDDTI BEGDT ENDDT DIFFMO
BY COUNTRY
WHERE READLIMIT EQ 1
END


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Expert
posted Hide Post
Nice methodology Ginny... Without the BOM's...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 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     [CLOSED] Creating a Field YYYYMM to compare with an interger field

Copyright © 1996-2020 Information Builders