I recommend reading up on the FTOA subroutine to see if this will work for your situation.
Data Migrator 5.3, 7.1, 7.6 WebFOCUS 7.1, 7.6, 7.7 SQL Server, Oracle, DB2 Windows
February 22, 2008, 11:05 AM
mgrackin
Jessica,
That is interesting to know. I am familiar with the FTOA function. I ended up creating a DEFINE FUNCTION due to the fact that my calculation has a number of steps. The return value from the function is an A16 so the DM varialbe handles the value fine. In the FUNCTION I use the PTOA function to convert the final numeric value to Alpha.
This might not mean anything to you but hears the code I created.
&BEG_DATE and &END_DATE are values from the input screen.
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
February 22, 2008, 12:57 PM
Francis Mariani
Mickey,
Very interesting. I haven't used DEFINE FUNCTION for purely DM yet.
Thanks for sharing that.
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
February 22, 2008, 01:43 PM
mgrackin
Francis,
This DEFINE FUNCTION capability in WF is great when you need to massage a data value supplied by a user. For example, our users enter a date range to select records. The problem is that the date/time values in the database are stored as the number of seconds from January 1, 1970 and are based on GMT instead of EST or DST time. Therefore I need to do a bunch of calculations to translate the dates entered by the user into values I can then plug into the WHERE clause. Doing this with a DM variable allows me to plug the raw values directly into the WHERE clause. This makes it possible for WF to build the SQL to pass to the database. If I called the DEFINE FUNCTION from a DEFINE field or from within the WHERE clause, the WHERE clause would not translate to SQL, forcing WF to pull all the records back and then process the selection, etc. etc.
Thanks!
Mickey
FOCUS/WebFOCUS 1990 - 2011
February 23, 2008, 01:54 PM
Danny-SRL
Mickey, Remember that all numeric calculations in DM are integer. That is the reason for the ***. Also, you can input numbers with a decimal point and digits after the decimal point but in any calculations the results will be integer. When using FTOA, the result is alpha hence no problems.
Daniel In Focus since 1982 wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF
February 25, 2008, 03:54 AM
Tony A
Danny,
quote:
calculations in DM are integer .... but in any calculations the results will be integer
On the version of WF that you are running that is not strictly true. Try this -