Focal Point
[SOLVED] Checkboxes for rows in a report

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

October 03, 2008, 02:58 PM
ChannyS
[SOLVED] Checkboxes for rows in a report
I have the following scenario.

I would like the users to be able to select employees from the Employee database based on first name and last name. I would like to show the first name and last name as separate fields so that they can choose to sort on each column (using a self-drilldown technique or the like). How can I give them a webpage that will give them this information with the ability to select the items (I'm thinking checkboxes to the left of each row)? Any ideas?

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


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 04, 2008, 09:56 AM
Waz
I think we need more information.

Do you mean a web page that is the result of aa report ?

Have you thought about embedding HTML in the report, there are many examples here in the forum.

The next question is what are you going to do with the selected employees ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 05, 2008, 12:26 AM
ChannyS
Last question first - I want to pass the selected employees as a variable along to a report that the user will run when hitting the "Run" button on the HTML page. Which I guess answers the first question - this is a launch page for a report that I would like to include this or similar functionality into.


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 06, 2008, 09:03 AM
GinnyJakes
Maybe I don't completely understand what you want to do but creating a report with the employess names set up to drill down to another report seems to me to be easier than what you want to do.

Unless, of course, you want to pass multiple employees. In that case, as Waz said, there is a recent post on text boxes in html that might be useful to you.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 06, 2008, 09:15 AM
ChannyS
Yes, I would like to pass multiple employees (amongst other parameters I am passing from the launch page). I will search for the post you are referring to.


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 06, 2008, 02:49 PM
ChannyS
OK - I found the post you were referring to and I followed it and put checkboxes in my report and I'm embedding that report in my launch page. The question now is how do I pass the selected values from the embedded report (along with other selections that were made in the launch page) when I hit the submit button?


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 06, 2008, 03:51 PM
GinnyJakes
If you practiced what was in that post, you will see that the boxes were passed as input variables which will be sent along with the form.

You can create a dummy focexec that is executed when the button is pushed and put a -? in it to see the variables and their contents.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 06, 2008, 05:05 PM
ChannyS
So is it that I must do it with a procedure that has the fex with the defines that create the checkboxes in HTML and then an HTMLFORM that uses !IBI.FIL....?

I'm not sure that would work for me as I'm trying to do this as an independent launch page.


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 06, 2008, 05:38 PM
GinnyJakes
quote:
I want to pass the selected employees as a variable along to a report that the user will run when hitting the "Run" button on the HTML page.


This is what you said. You have to write a report focexec that will run when the button is pushed and take the variables selected on your page and use them in a WHERE clause.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 06, 2008, 09:13 PM
j.gross
Channy --

If you give all the checkboxes the same HTML NAME attribute (say, EMP), they will act much like a multi-select listbox. Whenever the CGI receives identically names parameters, it converts them to a counter and a list of indexed parameters, so that each will come across in its own distinct &var.

If exactly one is checked, it gets passed as is -- the fex is in effect called with
EMP=value
and the dialog manager variable &EMP will contain the VALUE of the checked item.

If more than one is checked, the fex receives a list: a count in &EMP0, and values in &EMP1, &EMP2, .... (&EMP will also exist, with the same value as &EMP1)
If none checked, neither &EMP nor &EMP0 will exist.


You construct the necessary WHERE statement inline, at the appropriate spot within the TABLE request. (You could instead construct a &var containing the appropriate WHERE clause up front, but it's not advisable unless the field is numeric.) It was a pretty standard method before the advent of autoprompt.

Test for the existence of &EMP0 (first), and of &EMP (second), and branch accordingly -- either constructing
WHERE var IN (&EMP1, &EMP2, ...);
using a -REPEAT loop; or
WHERE var EQ &EMP;
or skipping the WHERE altogether.
(If the field is alpha, add .QUOTESTRING to all the &EMP references.)


You will need to suppress autoprompt for &EMP0 and &EMP (or whatever your parameters are named). One way is to include unreachable -SET statements, so the autoprompt scan will think they are local variables rather than parameters.


- Jack Gross
WF through 8.1.05
October 06, 2008, 10:08 PM
ChannyS
I guess I'm not being clear as to what I'm trying to do. I am familiar with passing checkbox values back to a fex with an appropriate WHERE and loop to test for the values. The problem I am having is that I included the report that has the rows with the checkboxes in HTML page that I am developing using DevStudio - HTML Painter. The report references the procedure and lives within an iFrame. When I hit the submit button, the checkbox is not being passed along with other values that have been input via various other controls (listboxes, radio buttons) etc. I assume it's because there is no XML variable setup for it. The question is how I can get the report that is in the iFrame to pass along it's selections to the HTML file that it lives in.


Release: WebFOCUS 7.6.8
OS: Windows
Output formats: HTML, PDF, Excel, csv
October 07, 2008, 09:09 AM
GinnyJakes
Take your report code out of your html page and put it in its own focexec. I use the HTML Painter as well but I never put the report code in the html. I always write and debug the report separately before I create the page.

We each have our own development style and mine works well for me. You might want to re-think your architecture. Several discreet easy pieces are easier to manage than one complicated one.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google