Focal Point
Using a specific date for a calculation

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

November 14, 2016, 10:10 AM
CB1125
Using a specific date for a calculation
How do I use a specific date (not contained in my synonyms) in a calculation? For example:

Here's my sample report. I want to look in the EffectiveDate column to find the nearest date to a specific date (not contained in my table) of 1/1/2013 and return the nearest UnitPrice by ProductName.

My date to compare (not in table) is: 1/1/2013

ProductName UnitPrice EffectiveDate Jan2013Price
ABC 3.75 2/1/2012 3.90
3.90 10/2/2012
4.18 1/2/2013
4.30 7/2/2013

DEF 3.91 2/1/2012 3.96
3.96 10/20/2012
4.20 1/20/2013
4.25 7/25/2013



I would like to display the nearest UnitPrice found in a new column titled Jan2013Price then grouped by product in my report:

Can this be done?


WebFOCUS 8
Windows, All Outputs
November 14, 2016, 11:27 AM
Francis Mariani
Apply the DATECVT function to the constant value so that it can be used in a date comparison function.

Here's an example:

DEFINE FILE GGORDER
ORDER_DATE_YYMD/YYMD = ORDER_DATE;

DAYS_DIF/P4 = DATEDIF( DATECVT(19960115, 'I8YYMD', 'YYMD'), ORDER_DATE_YYMD, 'D' );
END

TABLE FILE GGORDER
PRINT
ORDER_DATE_YYMD
DAYS_DIF
BY PRODUCT_CODE
END

In this example, to calculate the difference in days between a constant value and a column value, I use the DATEDIF function, and I am required to use the DATECVT function to convert the constant integer value into a date value. (I convert ORDER_DATE to a date value because in table GGORDER, ORDER_DATE has a date format of MDY (no century in the year component).


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
November 14, 2016, 11:28 AM
Francis Mariani
Apparently newer versions of WF 8 have new date functions that might make them easier to work with.


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
November 14, 2016, 11:52 AM
CB1125
I'm brand new to WF just installed a week ago. How do I define a file? Do I use the Procedure View to begin a define?

Also, if I have 4 different dates to use do I create one for each?


WebFOCUS 8
Windows, All Outputs
November 14, 2016, 01:10 PM
Francis Mariani
Welcome to FocalPoint.

You asked a very specific question regarding date manipulation, for which I provided an example solution.

It seems you do need a bit of training before you manipulate dates. have you read any manuals yet?

If you're suing a GUI to create reports, please read the appropriate manual.

Available online: WebFOCUS 8.0.08 Technical Library


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
November 15, 2016, 04:18 AM
Tony A
quote:
If you're suing a GUI to create reports

Freudian slip Francis? Wink

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 
November 15, 2016, 08:05 AM
Squatch
quote:
Originally posted by Tony A:
quote:
If you're suing a GUI to create reports

Freudian slip Francis? Wink

T

Can we make that a class action lawsuit? Wink


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
November 15, 2016, 09:41 AM
CB1125
Yes, I've taken my organizations introductory course without any issues. Seems that this piece wasn't covered. Thanks for your help.


WebFOCUS 8
Windows, All Outputs
November 15, 2016, 09:44 AM
CB1125
quote:
Originally posted by Squatch:
quote:
Originally posted by Tony A:
quote:
If you're suing a GUI to create reports

Freudian slip Francis? Wink

T

Can we make that a class action lawsuit? Wink


What is the class action lawsuit for?


WebFOCUS 8
Windows, All Outputs
November 15, 2016, 09:52 AM
Squatch
quote:
Originally posted by CB1125:
quote:
Originally posted by Squatch:
quote:
Originally posted by Tony A:
quote:
If you're suing a GUI to create reports

Freudian slip Francis? Wink

T

Can we make that a class action lawsuit? Wink


What is the class action lawsuit for?

"If you're suing a GUI to create reports..."

(It's especially funny coming from Francis.)


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
November 15, 2016, 09:54 AM
Francis Mariani
Are you using a GUI tool? The Procedure Viewer allows you to set up a DEFINE. It is documented:

WebFOCUS Release 8.0 Version 08 > Developer Studio > Creating Reporting Applications With Developer Studio > Creating Temporary Fields

WebFOCUS Release 8.0 Version 08 > App Studio > WebFOCUS App Studio Reference Guide > Creating Procedures in WebFOCUS App Studio

I don't believe a programmer should need to visit YouTube for technical assistance, but someone on the FocalPoint forum recently suggested perusing the Information Builders YouTube channel. I hope one can find something useful among the marketing material.


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
November 15, 2016, 09:56 AM
Francis Mariani
In this New New World Order, I hope I don't get sued!


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
November 15, 2016, 11:03 AM
CB1125
Yes, I am using the GUI. I was thinking it would be something similar to a db_lookup and hold but I must not have it written correctly as the forums formatting is a bit different than needed inside the compute box.


quote:
Originally posted by Francis Mariani:
Are you using a GUI tool? The Procedure Viewer allows you to set up a DEFINE. It is documented:

WebFOCUS Release 8.0 Version 08 > Developer Studio > Creating Reporting Applications With Developer Studio > Creating Temporary Fields

WebFOCUS Release 8.0 Version 08 > App Studio > WebFOCUS App Studio Reference Guide > Creating Procedures in WebFOCUS App Studio

I don't believe a programmer should need to visit YouTube for technical assistance, but someone on the FocalPoint forum recently suggested perusing the Information Builders YouTube channel. I hope one can find something useful among the marketing material.



WebFOCUS 8
Windows, All Outputs