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  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Compute Last Month's date in Dialogue Manager
Go
New
Search
Notify
Tools
Reply
  
[SOLVED]Compute Last Month's date in Dialogue Manager
 Login/Join
 
Gold member
posted
Hi all,
I have searched this site for solutions in getting last month date in Dialogue Manager in month-yyyy (i.e. October-2011) format. I tried many of these solutions, but haven't been able to get them to work. Your input is greatly appreciated.


Seyed

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


WebFOCUS 8.0.09
App Studio 8009
Linux Kernel-2.6
DBMS: Oracle 11g
all output (Excel, HTML, AHTML, PDF)
 
Posts: 89 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010Reply With QuoteReport This Post
Gold member
posted Hide Post
Does this work for you?

-SET &LASTMONTH=AYM(EDIT(EDIT(&YYMD,'999999$$')),-1,'I6YYM');
-SET &LASTMONTH_DESC=CHGDAT('I8YYMD','MYYX',&LASTMONTH,'A17');


WF: 8201, OS: Windows, Output: HTML, PDF, Excel
 
Posts: 78 | Registered: November 08, 2010Reply With QuoteReport This Post
Gold member
posted Hide Post
I just tried your solution, the result is blank.

Thank you,

Seyed


WebFOCUS 8.0.09
App Studio 8009
Linux Kernel-2.6
DBMS: Oracle 11g
all output (Excel, HTML, AHTML, PDF)
 
Posts: 89 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Works for me! You evaluated the resulting value of &LASTMONTH_DESC and it was blank?

In my environment, &LASTMONTH_DESC was assigned a value of "OCTOBER 2011".



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Reply With QuoteReport This Post
Expert
posted Hide Post
The result is blank? Is this because the code worked as expected?

Add
-TYPE &LASTMONTH_DESC
-TYPE &LASTMONTH
to see that it works.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
-TYPE &LASTMONTH_DESC
-TYPE &LASTMONTH

The following code results
-SET &LASTMONTH=AYM(EDIT(EDIT(&YYMD,'999999$$')),-1,'I6YYM');
-SET &LASTMONTH_DESC=CHGDAT('I8YYMD','MYYX',&LASTMONTH,'A17');

-TYPE &LASTMONTH_DESC
-TYPE &LASTMONTH


in

0


It looked like the '&YYMD' does not have a value to process, but when I type &YYMD, I get '20111115' which is correct.

Thanks,


Seyed
 
Posts: 89 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Try this:

-SET &THIS_MONTH     = EDIT(&YYMD,'999999$$');
-SET &LAST_MONTH     = AYM(&THIS_MONTH,-1,'I6YYM');
-SET &LASTMONTH_DESC = CHGDAT('I8YYMD','MYYX',&LAST_MONTH,'A17');

-TYPE &LAST_MONTH
-TYPE &LASTMONTH_DESC


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi all,
Thank you very much for your inputs. Dan’s solution worked for me. There is one more tweak that I must do. I now how to figure out a way to convert the result from ‘OCTOBER 2011’ to ‘October-2011’ with a dash in between and month name being as Microsoft Word calls it “title case”d.

Thanks again to Dan and everyone who contributed.

Seyed


WebFOCUS 8.0.09
App Studio 8009
Linux Kernel-2.6
DBMS: Oracle 11g
all output (Excel, HTML, AHTML, PDF)
 
Posts: 89 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010Reply With QuoteReport This Post
Gold member
posted Hide Post
This gets it all:

 
-SET &DATE1 = CHGDAT('YYMD', 'MXYY', DATECVT(DATEADD(DATECVT(&YYMD, 'I8YYMD', 'YYMD'), 'M', -1),'YYMD','A8YYMD'), 'A17');
-SET &DATE2 = EDIT(&DATE1,'9')|LOCASE(17,EDIT(&DATE1,'$9999999999999999'),'A17');
-SET &DATE3 = STRREP(&DATE2.LENGTH,&DATE2,2,' 2''',2,'-2''',&DATE2.LENGTH,'A&DATE2.LENGTH');

-TYPE &DATE1 &DATE2 &DATE3

 


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
 
Posts: 84 | Registered: December 13, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
Hi Microfich,
Thank you very much. Your solution worked nicely. Again, thanks everyone.

Seyed


WebFOCUS 8.0.09
App Studio 8009
Linux Kernel-2.6
DBMS: Oracle 11g
all output (Excel, HTML, AHTML, PDF)
 
Posts: 89 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Here's yet another way:

-SET &LASTMONTH      = DATECVT(DATECVT(DATEADD(DATECVT(&YYMD,'I8YYMD','YYMD'),'M',-1),'YYMD','A8YYMD'),'A8YYMD','MYY');
-SET &LASTMONTH_DESC = DATETRAN(&LASTMONTH, '(MYY)', '(tr-)', 'EN', 20, 'A20');
-TYPE &LASTMONTH_DESC



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Reply With QuoteReport This Post
Gold member
posted Hide Post
quote:
-SET &LASTMONTH = DATECVT(DATECVT(DATEADD(DATECVT(&YYMD,'I8YYMD','YYMD'),'M',-1),'YYMD','A8YYMD'),'A8YYMD','MYY');
-SET &LASTMONTH_DESC = DATETRAN(&LASTMONTH, '(MYY)', '(tr-)', 'EN', 20, 'A20');
-TYPE &LASTMONTH_DESC


Hi njsden,
I appreciate your input.

Seyed


WebFOCUS 8.0.09
App Studio 8009
Linux Kernel-2.6
DBMS: Oracle 11g
all output (Excel, HTML, AHTML, PDF)
 
Posts: 89 | Location: Oklahoma City, Oklahoma | Registered: July 01, 2010Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Compute Last Month's date in Dialogue Manager

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