Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Include records with last month's dates

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Include records with last month's dates
 Login/Join
 
Gold member
posted
Hello:
The more I read on dates, the more I get confused. I am trying to create a report that only includes records with dates in the previous month. The table has a field, CALL_DATE (USAGE=YYMD), that holds the date of incoming calls.

Since we will always run this report after the month end close, I want to look at TODAY and include any records that are a month older. For example, if I run the report today (2007/12/07), I want to pull all records from November 2007.

Any help would be great. I was working with &TODAY and AYM to get the year and month I wanted to look for, but I couldn't get the right commands to get CALL_DATE in that same format to do a WHERE CALL_DATE2 EQ &OUT. I was getting strange numbers in my attempts to reformat CALL-DATE.

 
-SET &TODAY = (&YYMD-1)/100;
-SET &OUT = AYM(&TODAY, -1, 'I6');
 


This sets &OUT to 200711, now how can I get CALL_DATE in this format in CALL_DATE2? Is there a better way other than the way I am approaching it?

Thanks,
Tim
 
Posts: 57 | Registered: February 24, 2004Report This Post
Expert
posted Hide Post
Here's one way:

-SET &ECHO=ALL;

-SET &DT1 = EDIT(&YYMD,'999999');
-SET &DT2 = AYM(&DT1, -1, 'I6');

-SET &DT_FROM = &DT2 | '01';
-SET &DT_TO   = &DT1 | '01';

-TYPE &DT_FROM - &DT_TO;

TABLE FILE SOMETHING
PRINT *
WHERE DB_DATE GE '&DT_FROM' AND DB_DATE LT '&DT_TO'
END


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, 2005Report This Post
Gold member
posted Hide Post
Francis:

Thank You! That worked great! I saw that there is a book, 1001 Ways to Work with Dates in Focus. It sounds like a good purchase for me to make.

Have a great Holiday Season! Thank you for providing so much help to everyone on this forum! That goes for everyone on this great Focal Point Board!

Happy Holidays!

Tim
 
Posts: 57 | Registered: February 24, 2004Report This Post
Platinum Member
posted Hide Post
Hi Tim,

Here's another idea using defined fields:

DEFINE FILE YOURFILE
CUR_DATE/YYMD = &YYMD;
CUR_MNTH/YYM = CUR_DATE;
PRV_MNTH/YYM = CUR_MNTH - 1;
-*
CALL_MNTH/YYM = CALL_DATE;
END
-*
TABLE FILE YOURFILE
PRINT *
WHERE CALL_MNTH EQ PRV_MNTH
END

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Virtuoso
posted Hide Post
Using Francis suggestion would be more efficient because is allows the selections to be passed to the RDBMS. Using a DEFINEd field in a WHERE does not allow for this and should be avoided when possible.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
Tim

We have in our EDASPROV.PRV file several && values defined.
One is the &&PREVMONTH that is based upon the actual date, so I always can point to that value and use it.

My solution would therefor be

DEFINE FILE SOMETHING
DBMONTH/YYM=DB_DATE;
END
TABLE FILE SOMETHING
PRINT *
WHERE DBMONTH EQ '&&PREVMONTH';
END



I can do the same with &&ACTYEAR or &&PREVYEAR etc




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
Now that's a good idea - sticking that code in edasprof.prf so the vars are available for all fexes (except for ReportCaster I assume). Thanks Frank.

Cheers,


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, 2005Report This Post
Virtuoso
posted Hide Post
Francis

It works for RC as well (but that runs on the same server.
And if it was on an other server you can put the same settings on the other of course.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Include records with last month's dates

Copyright © 1996-2020 Information Builders