Focal Point
Changing format of report variable

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3511025282

May 01, 2008, 10:45 AM
MO Admin
Changing format of report variable
I am developing a report based on DB2 SQL. I pull in a datetime stamp and use the SQL function DATE() to pull just that out. I then set up a date parameter that checks aginst this field.

My problem is that this field comes out as YYMD. I can change that format on the report to MDYY, but cannot figure out how to change the variable so that I users can type in the date ranges as MM/DD/YYYY, and also display in this format in the report header.

Any help is greatly appreciated.

Thanks,


Kevin
______________________
Production: WebFocus 7.6.11 on Win2K3 Server
Test: WebFocus 7.6.11 on Win2K3 Server
Formats: Excel2K, PDF, HTML
May 01, 2008, 11:02 AM
GinnyJakes
Kevin,

Have the users specify the date in the MM/DD/YYYY format then use Dialogue Manager to switch the pieces around to create the variable that you use to do the WHERE clause. Do you know anything about DM? Hints: EDIT function to extract the date pieces, concatenation to put them together in the correct order.

Also, in your profile signature, please specify your product suite, releases, and platform(s) so we may better help you.


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
May 01, 2008, 11:17 AM
MO Admin
I am familiar with the EDIT function, but not so much Dialogue Manager, especially when creating a report from SQL.

Would that go between the SQL and the report file?


Kevin
______________________
Production: WebFocus 7.6.11 on Win2K3 Server
Test: WebFocus 7.6.11 on Win2K3 Server
Formats: Excel2K, PDF, HTML
May 01, 2008, 11:19 AM
Tom Flynn
MO Admin,

This is just another idea:

The simplest way to return a date in the format you desire is to use the built-in column function CHAR. Using this function you can convert a date column into any number of formats. The specific format you request, MM/DD/YYYY, is the USA date format. So, for example, to return the date in the format you requested for a column named START_DATE you would code the function as follows:

CHAR(START_DATE,USA)

OR

DATE(SUBSTR(START_DATE,5,2) || "/" || SUBSTR(START_DATE,7,2) || "/" || SUBSTR(START_DATE,1,4))


Hope this helps...


Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 01, 2008, 11:26 AM
MO Admin
It is not the column that I am having a problem with. It is the &variable for the date range.

I want to type 05/01/2008 instead of 20080501. In the report heading, it shows the way it is typed in.


Kevin
______________________
Production: WebFocus 7.6.11 on Win2K3 Server
Test: WebFocus 7.6.11 on Win2K3 Server
Formats: Excel2K, PDF, HTML
May 01, 2008, 11:29 AM
Tom Flynn
Kevin,

OK, Ginny gave you the answer, BUT, with only 7 posts, here's the code:

-SET &NEW_DATE = EDIT(&VARIABLE,'$$$$99/') || EDIT(&VARIABLE,'$$$$$$99/')|| EDIT(&VARIABLE,'9999');

OR

-SET &NEW_DATE = EDIT(&VARIABLE,'$$$$99/99/') || EDIT(&VARIABLE,'9999');

&VARIABLE is your incoming &NAME
&NEW_DATE now goes in the HEADING...

This message has been edited. Last edited by: Tom Flynn,


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
May 01, 2008, 02:05 PM
MO Admin
Thanks Tom and Ginny.

I used NEW_DATE for the where statement by converting MM/DD/YYYY into YYMD format by way of the EDIT in Dialogue Manager, and left the origional (&VARIABLE) as what is keyed in and what is displayed in the report header.

Thanks for you time.


Kevin
______________________
Production: WebFocus 7.6.11 on Win2K3 Server
Test: WebFocus 7.6.11 on Win2K3 Server
Formats: Excel2K, PDF, HTML