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     [SOLV] Use Report Parameters to help calculate 2 sets of totals within same procedure

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLV] Use Report Parameters to help calculate 2 sets of totals within same procedure
 Login/Join
 
Gold member
posted
Have a database of records with with only 3 fields in each record:
class_name char(14)
start_date (date)
end_date (date)

What I would like to do is create a report that will prompt the user to enter a start/end date of the effective period then the report would display # the of classes that started during the effective period and # of classes that ended during the effective period,

I have created seperate reports for each total I want but can't come up with a way to calculate and display both totals within one procedure using the dates entered for the report parameters. Know I've probably made this harder than it really is but worked on is until I'm ready to ask for help.

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


7.7.02 Windows7
HTML/Excel/PDF
 
Posts: 66 | Registered: April 16, 2008Report This Post
Gold member
posted Hide Post
Jeff,

Can you start by giving us a sample of your code?

from first glance it seems that you are looking for a simple prompt that would look like this

  WHERE (end_date FROM &STARTDAT TO &ENDDATE) 
OR (start_date FROM &STARTDAT TO &ENDDATE) 


That will give you the prompts your looking for.

Then to do your counts you would want to use a define field where it creates a counter whenever an end date is in the date range and another field when the start date in the date range.

Eric

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


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
 
Posts: 95 | Registered: July 31, 2007Report This Post
Platinum Member
posted Hide Post
Jeff - Here are the steps you can try -

1) Put out the totals lines to two different Hold files in two different TABLE FILE steps

2) Append the 2 files back in the order you need them to be. (If you also need some data-details lines on the top, then it will make it 3 files - The details Hold-file, The totals-line-1-hold-file & totals-line-2--hold-file.


3) TABLE FILE PRINT the consolidated file.

The little trick here is to make the totals-line hold-files be of the same exact record layout as the details file. You could do that by having some dummy compute fields to fill in the space as needed.

Hope that makes sense.
Sandeep Mamidenna


-------------------------------------------------------------------------------------------------
Blue Cross & Blue Shield of MS
WF.76-10 on (WS2003 + WebSphere) / EDA on z/OS + DB2 + MS-SQL
MRE, BID, Dev. Studio, Self-Service apps & a dash of fun !! Music
 
Posts: 218 | Location: Jackson, MS | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Eric,
This was my first thought on how to do this but is it possible to use the report prompt variables in a define statement. I've set up the report prompts but when I go to set up the define(s) the report prompt variables i.e. startdate & enddate do not show up in the available fields for use in the define expression


7.7.02 Windows7
HTML/Excel/PDF
 
Posts: 66 | Registered: April 16, 2008Report This Post
Expert
posted Hide Post
Jeff,

Too much eggnog?

Using straight code via edit

DEFINE FILE yourfile
-* Using boolean
CLASS_BEG/I9 = start_date FROM &STARTDAT TO &ENDDATE;
CLASS_END/I9 = end_date FROM &STARTDAT TO &ENDDATE;
END

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Master
posted Hide Post
If all you are want are total counts try:

TABLE FILE yourfile
SUM
COMPUTE TOT_STARTS/I5=IF START_DATE FROM &START TO &END THEN 1 ELSE 0;
COMPUTE TOT_END/I5=IF END_DATE FROM &START TO &END THEN 1 ELSE 0;
END


IF you are also wanting to print the list of classes try:

TABLE FILE yourfile
SUM
COMPUTE TOT_STARTS/I5=IF START_DATE FROM &START TO &END THEN 1 ELSE 0; NOPRINT
COMPUTE TOT_END/I5=IF END_DATE FROM &START TO &END THEN 1 ELSE 0; NOPRINT
PRINT
CLASS_NAME START_DATE END_DATE
WHERE START_DATE FROM &START TO &END
OR END_DATE FROM &START TO &END

ON TABLE SUBFOOT
"Totals END


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
quote:
TABLE FILE yourfile
SUM
COMPUTE TOT_STARTS/I5=IF START_DATE FROM &START TO &END THEN 1 ELSE 0;
COMPUTE TOT_END/I5=IF END_DATE FROM &START TO &END THEN 1 ELSE 0;
END


You need to use DEFINE (rather than COMPUTE) to get the count of matching records.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Gold member
posted Hide Post
Maybe I'm trying to make it harder than it seems. When trying to set up a define like was mentioned i.e. can't seem to make it accept the &STARTDAT, &ENDATE parameters in the expression.
Get message saying no value found for &STARTDAT or &ENDDATE

DEFINE FILE REG
CLASS_BEG/I9 = start_date FROM &STARTDAT TO &ENDDATE;
CLASS_END/I9 = end_date FROM &STARTDAT TO &ENDDATE;
END


7.7.02 Windows7
HTML/Excel/PDF
 
Posts: 66 | Registered: April 16, 2008Report This Post
Gold member
posted Hide Post
Do you have Prompt for Parameters turned off on the report?


Eric Woerle
WF 7.6.7 Reportting Server
ETL 7.6.10
Dev Studio 7.6.7
 
Posts: 95 | Registered: July 31, 2007Report This Post
Gold member
posted Hide Post
Not that I'm aware of. I set up a basic report using Developer Studio just to print a list of classes where the class start date falls during the effective period. I clicked on the WHERE/IF button to set up the parameters to prompt for the start_date and end_date of the effective period. I can run this report and I'm prompted to enter a start and end date and the report prints out the appropriate classes. When I go to set up the define this is where I'm encountering the problem. The DEFINE wizard does not show the parameters &start_date and &end_date as being available in the list of fields.

Hope I'm not confusing you more that probably already have.


7.7.02 Windows7
HTML/Excel/PDF
 
Posts: 66 | Registered: April 16, 2008Report This Post
Virtuoso
posted Hide Post
Your parameters are &STARTDAT and &ENDDATE, not &start_date and &end_date. I know that's probably stating the obvious, but based on your information and the code in your last post, that's what there is to go on. Parameters that have been created using -SET or -DEFAULT (or -PROMPT) must match exactly (even in Case) to the ones that are referenced in your DEFINE or TABLE sections. If they are already matching EXACTLY, try setting up a default value using -DEFAULT at the beginning of your fex and see if it runs.

As Eric, mentions, it sounds like the "Prompt for parameters" is turned off or it would be asking you for any parameters that are unresolved. Right click your procedure, click properties, and make sure that the Prompt for parameters box is checked.


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
Gold member
posted Hide Post
Thanks for all the input. Due to other work commitments I have to temporary suspend working on this procedure. I hope to readdress in the coming weeks.


7.7.02 Windows7
HTML/Excel/PDF
 
Posts: 66 | Registered: April 16, 2008Report This Post
Gold member
posted Hide Post
Ok I had to take one more look at everyones replies and what I had done and I think I finially solved the problem I was having.

My origional define statement:
DEFINE FILE reg
CLASS_BEG/I9 = start_date FROM &STARTDAT TO &ENDDATE;
CLASS_END/I9 = end_date FROM &STARTDAT TO &ENDDATE;
END

what I discovered was that I needed to put single quotes ' around the parameter variables (to designate parameters to be treated as dates? )Once I did this everything seemed to fall in place.

DEFINE FILE reg
CLASS_BEG/I9 = start_date FROM '&STARTDAT' TO '&ENDDATE';
CLASS_END/I9 = end_date FROM '&STARTDAT' TO '&ENDDATE';
END


7.7.02 Windows7
HTML/Excel/PDF
 
Posts: 66 | Registered: April 16, 2008Report This Post
Gold member
posted Hide Post
SOLVED


7.7.02 Windows7
HTML/Excel/PDF
 
Posts: 66 | Registered: April 16, 2008Report 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     [SOLV] Use Report Parameters to help calculate 2 sets of totals within same procedure

Copyright © 1996-2020 Information Builders