Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    DATEADD but in Focus Variable?
Go
New
Search
Notify
Tools
Reply
  
DATEADD but in Focus Variable?
 Login/Join
 
Gold member
posted
Hi, So i have been searching for a thread to help me out but i believe the code i'm finding works in Dialogue Manager but not in focus code when creating a variable via a procedure?

What i'm trying to do is get the max date of a column from a table and substract 1 month. i have it corrected pulling the latest date however i can't seem to get it to substract 1 month?

Here is my code so far:

-SET &DDDATE=;

DEFINE FILE DAD
WRKD/A8YYMD=Discharge_Date;
WRKDA/A10=EDIT(WRKD,'9999/99/99');
-*WRKDAY=DATEADD(WRKDA,'M', -7); <- I believe this is the correct place to take the date which i have captured and just go back 1 month?
END


TABLE FILE DAD
SUM MAX.WRKDA
ON TABLE HOLD AS WD FORMAT ALPHA
END
-RUN

-READ WD &DDDATE.A10.

-RUN

-SET &&DDDATE='&DDDATE.EVAL';
&&DDDATE

Any help would be greatly appreciated thank you!


WebFocus 8.02, SQL Server 2008r2
 
Posts: 51 | Registered: November 30, 2012Reply With QuoteReport This Post
Expert
posted Hide Post
What is the format of Discharge_Date ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.05OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Know The Code

 
Posts: 6072 | Location: Land of the Darug people, Terra Australis Incognita | Registered: October 31, 2006Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Hi,

As per the WebFOCUS "Using Functions" manual:
quote:

DATEADD requires a date to be in date format. Since Dialogue Manager interprets a date as alphanumeric or numeric, and DATEADD requires a standard date stored as an offset from the base date, do not use DATEADD with Dialogue Manager unless you first convert the variable used as the input date to an offset from the base date.


So, as per the example:
TABLE FILE EMPLOYEE
PRINT FIRST_NAME HIRE_DATE 
COMPUTE NEW_DATE/YYMD = HIRE_DATE;
COMPUTE HIRE_DATE_PLUS_THREE/YYMD = DATEADD(NEW_DATE, 'WD', 3);
BY LAST_NAME
END


Your "in" date needs to be e.g. YYMD format.
And the "out" date (WRKDAY) needs a format.

So, if Discharge_Date is already a YYMD format, you probably need something like this:

  WRKDAY/YYMD=DATEADD(Discharge_Date,'M', -7); 


WebFOCUS 8.2.06 mostly Windows Server
 
Posts: 201 | Location: Johannesburg, South Africa | Registered: September 13, 2008Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Use AYMD() for &VARs (Dialogue Manager)

  
-SET &DAY15 = AYMD(&YYMD, -15, 'I8');


WF 7.7.05
HP-UX - Reporting Server, Windows 2008 - Client, MSSQL 2008, FOCUS Databases, Flat Files
HTML, Excel, PDF
 
Posts: 149 | Location: Dallas, TX | Registered: June 08, 2007Reply With QuoteReport This Post
Master
posted Hide Post
Need to use DATEADD, DATEMOV and DATEDIF in Dialogue Manager?

Use DEFINE FUNCTION

Check out my post here:

Using DATE Functions in DM


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 908 | Location: Oklahoma City | Registered: October 27, 2006Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
Discharge

Hi Waz,

Discharge date is in 'YYYY-MM-DD'

thank you guys the only thing is Dialogue manager (in webfocus) is not the same as a procedure (in data migrator? uses focus langauge?) i'm trying to do this for a flow so i set a global variable so it can be used later on in the flow

example

where Discharge_Date = %%DDDATE

maybe i'm mixing the two up?


WebFocus 8.02, SQL Server 2008r2
 
Posts: 51 | Registered: November 30, 2012Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    DATEADD but in Focus Variable?

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.