Focal Point
[SOLVED] "All" static value in Drop down list

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/413102662

October 13, 2009, 02:12 PM
cevans
[SOLVED] "All" static value in Drop down list
All,

I have been tasked to modify an inherited report to include in the drop down list of the html page an "All" value.

This list consists of static values which are generated in the "Define" section of the procedure. The define is along the lines of:

IF location EQ 'A' THEN 'value1' ELSE IF location EQ 'B' THEN 'value2' ELSE IF location CONTAINS 'C' OR 'D' THEN 'value3'...and so on.

Any ideas on how to Get an "All" value in the drop down list which will bring back all values for all these locations?

Thanks,
Craig

This message has been edited. Last edited by: cevans,
October 13, 2009, 02:19 PM
Microfich
Within the
 <SELECT> 
tag, just place this
 <OPTION> 
tag:
 <option value="$*" selected>ALL </option> 


Drop-down will now show the ALL option, which will be passed to the (report) code with a value of '$*', which can be checked for.


WebFOCUS 8105
Windows;
DB2, UDB, SQL Server, Oracle
FOCUS-WebFOCUS since 1981
October 13, 2009, 02:26 PM
Darin Lee
Using the painter, when you the the ALL option it passes a value of FOC_NONE. This is a key word the FOCUS uses to ignore the line on which it is found. So if the display is "ALL" and the value is "FOC_NONE" then the FOC_NONE value gets passed the the line WHERE fieldname EQ value and the selection line is ignored, essentially retrieving all values.

One question that I did have based on your description, is are you using a DEFINEd field in your selection criteria? That should be avoided if at all possible as it causes a complete table scan. You should stick to real fields for selection criteria.


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
October 13, 2009, 02:41 PM
cevans
Thanks for the responses!

Microfich, I did what you said (well, from the front end as I am not a code guy) and it worked! I knew it had to be something relatively simple. I just added a static value with the value of $* and a display of All and got the data I wanted. (Will have to spot check but looks like the number I was expecting.)

One question for you though:

The report has in its Page Heading...&PROCESS. (PROCESS being the Define filed with the static values) As it is now I am getting the results I desire but with a heading telling the user they ran a report for "$*" processes and not "All" processes. Any ideas how to get the word "All" up there?

Thanks,
Craig
October 13, 2009, 02:44 PM
cevans
Darin,

I tried using FOC_NONE in for the value but the query was taking so long I figured it eliminated the where clause completely or something as it seemed it was going to return far too much.

I am using a defined filed in the where clause of this report. I inherited this report so maybe I would have figured another way to accomplish the report, maybe not. I am just not trying to re-invent the wheel for this report and just work with it how it is.

I will definitely keep the tip in mind for future reports I create though.

Thanks,
Craig
October 13, 2009, 03:02 PM
Francis Mariani
FOC_NONE will eliminate the whole line it appears on. If you have a compound WHERE statement that is coded on one line, the whole statement gets ignored.


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
October 13, 2009, 03:28 PM
cevans
Thanks Francis and Darin,

I see what you guys mean now. It was a fairly large where statement which was all entered on the same line. I made it like below and used the FOC_NONE method and it worked:

WHERE
PROCESS EQ '&PROCESS' AND
this EQ that AND this LE that and etc...

It oddly eliminates the heading section saying "report ran for: "&PROCESS'" I guess that is all good though since that heading really only needs to be there when choosing a single area as the full report implies "All areas"

Thanks for the help everyone!
October 13, 2009, 03:46 PM
Francis Mariani
quote:
FOC_NONE will eliminate the whole line it appears on
even HEADING lines...


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
October 13, 2009, 04:01 PM
cevans
did not even think of that Francis. durrr...lol

thanks!