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] Long Date conversion to YYMD

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Long Date conversion to YYMD
 Login/Join
 
Silver Member
posted
Hi Guys,

I know this should be easy but cannot get it at the moment. How do I convert a long date, eg FEBRUARY 02 1982 to YYMD in my fex procedure?

Thanks

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS App Studio 8202M
Windows, All Outputs
 
Posts: 34 | Registered: May 22, 2014Report This Post
Platinum Member
posted Hide Post
Hi ration ,

Can you please confirm what is the date format in data base .


WF Production :- WF:8.0.0.4, 8.1.05 App-studio/Developer Studio(8.1.x) ,
8.2.0.1M , 8.2.0.2 (App-Studio8.2.x),
InfoAssist/+, InfoDiscovery
Output format:-AHTML, PDF, Excel, HTML
Platform:-Windows 7, 8,10
 
Posts: 186 | Location: Infobuild India | Registered: August 28, 2015Report This Post
Silver Member
posted Hide Post
Hi Chaudhary,

Actually not getting it from a database but getting the date in that format from the calendar tool and would like to convert it to YYMD.



WebFOCUS App Studio 8202M
Windows, All Outputs
 
Posts: 34 | Registered: May 22, 2014Report This Post
Virtuoso
posted Hide Post
Are you trying to change the format of the Calendar selection or the format of the field it populates? I don't think you can change the display format of the Calendar date picker. But if you're trying to change the format of the variable you're populating for display in the report, then you can use a DEFINE to make it display YYMD.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Silver Member
posted Hide Post
BabaNYC, I'm actually trying to take the date I get from the Calendar (eg April 13, 2018) and subtract 90 days from it. So I'm trying to change the format of the variable so I can do the DATEADD. Can you give me an example of the DEFINE on the variable?

Thanks


WebFOCUS App Studio 8202M
Windows, All Outputs
 
Posts: 34 | Registered: May 22, 2014Report This Post
Virtuoso
posted Hide Post
Which brings us back to Chaudhary's question. What's the format of the date field you're populating with this variable? So, for instance, if you have a WHERE MYDATE EQ &DATE_VAR then you need to tell us what the format of the field MYDATE is. If you're not sure, you can hover over it in InfoAssist and it'll give you a popup with the format. The calculations will be performed on that field not the &DATE_VAR.


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Silver Member
posted Hide Post
Oh ok. The format would be I8YYMD so 20180413


WebFOCUS App Studio 8202M
Windows, All Outputs
 
Posts: 34 | Registered: May 22, 2014Report This Post
Virtuoso
posted Hide Post
You'll need something like this:
 90DAYSAGO/I8YMD = AYMD(HIRE_DATE, -90, 90DAYSAGO); 


https://webfocusinfocenter.inf...lang/source/aymd.htm


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Silver Member
posted Hide Post
Thanks BabaNYC and Chaudhary. I was able to get what I wanted.


WebFOCUS App Studio 8202M
Windows, All Outputs
 
Posts: 34 | Registered: May 22, 2014Report This Post
Master
posted Hide Post
I see that you already have this taken care of. However, if you'd like my 2¢ then you can look at what I would do to create new variables in an I8YYMD format:
 
-DEFAULTH &DATE_CONVT='';
-DEFAULTH &DATE_90AGO='';

DEFINE FILE CAR
DATE_BEGIN/A17='&DATE_START.(|FORMAT=YYMD).From Date.';
DATE_CONVT/YYMD=HINPUT(17, DATE_BEGIN, 20, 'HYYMD'); 
DATE_90AGO/YYMD=DATEADD(DATE_CONVT, 'D', -90);
END

TABLE FILE CAR
SUM DATE_CONVT DATE_90AGO
BY CAR NOPRINT
WHERE CAR EQ 'AUDI';
ON TABLE HOLD AS NEWAMPERS FORMAT BINARY
END
-RUN
-READFILE NEWAMPERS

-TYPE &|DATE_START [&DATE_START.TYPE&DATE_START.LENGTH] = &DATE_START
-TYPE &|DATE_CONVT [&DATE_CONVT.TYPE&DATE_CONVT.LENGTH] = &DATE_CONVT 
-TYPE &|DATE_90AGO [&DATE_90AGO.TYPE&DATE_90AGO.LENGTH] = &DATE_90AGO 


When selecting today's date I get the following output:
 
0 NUMBER OF RECORDS IN TABLE=        1  LINES=      1 
&DATE_START [A13] = April 20 2018
&DATE_CONVT [N08] = 20180420
&DATE_90AGO [N08] = 20180120


From what I understand (please if someone knows differently, I'm all ears), amper variables can only store alpha or numeric data. So you cannot use an actual date format in a variable and do date calculations in the dialog manager.

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


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Virtuoso
posted Hide Post
Hallway

You are correct, you would have to create a DEFINE'd field in DATE format to do the calculations.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
 
Posts: 2127 | Location: Customer Support | Registered: April 12, 2005Report This Post
Master
posted Hide Post
So I just found this gem by Francis Mariani that explains how to create your own function to do date calculations in DM:

Simplifying the Use of Date Functions in Dialogue Manager

So my example above can be simplified to this:
  
DEFINE FUNCTION UDATEADD(INDATE/A17, INUNIT/A2, INNBR/I4)
INDATE_YYMD/YYMD = HINPUT(17, INDATE, 20, 'HYYMD');
UDATEADD/I8YYMD  = DATEADD(INDATE_YYMD, INUNIT, INNBR);
END
-RUN

-SET &DATE_START = &DATE_START.(|FORMAT=YYMD).From Date.;
-SET &DATE_90AGO = UDATEADD('&DATE_START.EVAL', 'D', -90);

-TYPE &|DATE_START [&DATE_START.TYPE&DATE_START.LENGTH] = &DATE_START
-TYPE &|DATE_90AGO [&DATE_90AGO.TYPE&DATE_90AGO.LENGTH] = &DATE_90AGO

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


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
 
Posts: 608 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Report This Post
Virtuoso
posted Hide Post
BEST. SIGNATURE. EVER!! ^^^^^^^^^^


8.2.02M (production), 8.2.02M (test), Windows 10, all outputs.
 
Posts: 1113 | Location: USA | Registered: January 27, 2015Report This Post
Silver Member
posted Hide Post
quote:
Originally posted by Hallway:
So I just found this gem by Francis Mariani that explains how to create your own function to do date calculations in DM:

Simplifying the Use of Date Functions in Dialogue Manager

So my example above can be simplified to this:
  
DEFINE FUNCTION UDATEADD(INDATE/A17, INUNIT/A2, INNBR/I4)
INDATE_YYMD/YYMD = HINPUT(17, INDATE, 20, 'HYYMD');
UDATEADD/I8YYMD  = DATEADD(INDATE_YYMD, INUNIT, INNBR);
END
-RUN

-SET &DATE_START = &DATE_START.(|FORMAT=YYMD).From Date.;
-SET &DATE_90AGO = UDATEADD('&DATE_START.EVAL', 'D', -90);

-TYPE &|DATE_START [&DATE_START.TYPE&DATE_START.LENGTH] = &DATE_START
-TYPE &|DATE_90AGO [&DATE_90AGO.TYPE&DATE_90AGO.LENGTH] = &DATE_90AGO


Thanks Hallway for posting the simplified version. Its GREAT!
And I agree with CoolGuy... awesome signature! Big Grin


WebFOCUS App Studio 8202M
Windows, All Outputs
 
Posts: 34 | Registered: May 22, 2014Report 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] Long Date conversion to YYMD

Copyright © 1996-2020 Information Builders