Focal Point
[CLOSED] How do I make checkboxes not required?

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

October 11, 2011, 06:53 PM
a415
[CLOSED] How do I make checkboxes not required?
Still new to WebFocus (ver 7.7.02) and I built a report that would require users to check a box for YES or leave the box blank for NO.

My Version 1 WHERE statements look like this
(WHERE/IF > Column EQUALS Parameter > Compare Variable (Variable Type: SINGLE SELECT) > Static List:
WHERE TABLE1.TABLE1.A_ALUMNI EQ '&A_ALUMNI.(<Y,Y>).A_ALUMNI.';
WHERE TABLE1.TABLE1.A_DONOR EQ '&A_DONOR.(<Y,Y>).A_DONOR.';
WHERE TABLE1.TABLE1.B_ALUMNI EQ '&B_ALUMNI.(<Y,Y>).B_ALUMNI.';
WHERE TABLE1.TABLE1.B_DONOR EQ '&B_DONOR.(<Y,Y>).B_DONOR.';

*The reason why I didn't put "No Selection" or
<N,N>
is because I only want ONE checkbox per variable, not TWO.*

My Version 2 WHERE statements look like this
(WHERE/IF > Column EQUALS Parameter > Compare Variable (Variable Type: SIMPLE):
WHERE TABLE1.TABLE1.A_ALUMNI EQ '&A_ALUMNI';
WHERE TABLE1.TABLE1.A_DONOR EQ '&A_DONOR';
WHERE TABLE1.TABLE1.B_ALUMNI EQ '&B_ALUMNI';
WHERE TABLE1.TABLE1.B_DONOR EQ '&B_DONOR';

On the HTM file, I referenced the report and it automatically brought in the variables and I chose 'checkbox' in the CONTROL TYPE column. In the properties, I set it so that all boxes are NOT selected to allow the user to make the selection of which information they want to display. But when I run EITHER VERSION, I have red boxes that go around the unchecked boxes, indicating that a selection is required.

How do I make it ONE checkbox per field instead of a YES box and NO box (I also don't want a drop down of YES or NO... specifically one checkbox). Is there something I'm doing wrong in the WHERE/IF in the GUI? Or is it something I need to do on the HTM file of the checkbox properties?

Thanks!

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


8009
Windows 7
Excel/HTML/AHTML/PDF
October 12, 2011, 08:52 AM
Wep5622
No idea how exactly that ( <Y, Y> )-stuff works, apparently you're using the auto-prompter to create your forms? Anyway...

We usually just add a defaults for the no-values.
-DEFAULT &A_ALUMNI = 'N'
-DEFAULT &A_DONOR = 'N'
-DEFAULT &B_ALUMNI = 'N'
-DEFAULT &B_DONOR = 'N'



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
October 12, 2011, 09:19 AM
njsden
In HTML composer, select your checkbox(es), and in the properties pane set "Selection required" to "No". That should do it.



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.
October 12, 2011, 12:51 PM
a415
I updated the report with both of your suggestions so that I have:
-DEFAULT &A_ALUMNI = 'N'
-DEFAULT &A_DONOR = 'N'
-DEFAULT &B_ALUMNI = 'N'
-DEFAULT &B_DONOR = 'N'
...
...
WHERE TABLE1.TABLE1.A_ALUMNI EQ '&A_ALUMNI';
WHERE TABLE1.TABLE1.A_DONOR EQ '&A_DONOR';
WHERE TABLE1.TABLE1.B_ALUMNI EQ '&B_ALUMNI';
WHERE TABLE1.TABLE1.B_DONOR EQ '&B_DONOR';


I also selected each checkbox, and in the properties pane, I set:
Default Selection: No (also tested with Default Selection: Yes)
Selection Required: No (thanks for this @njsden!)

When I run it with ALL boxes checked, the report hangs and freezes everything until I can open the Task Manager to end IE. But if any of the boxes are unchecked, I get this error instead of any actual results:
quote:
--------------------------------------------------------------------------------

Your request did not return any output to display.
Possible causes:
- No data rows matched the specified selection criteria.
- Output was directed to a destination such as a file or printer.
- An error occurred during the parsing or running of the request.


--------------------------------------------------------------------------------


0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0




Everyone in TABLE1 has AT LEAST one 'Y' in any of the columns A_ALUMNI, A_DONOR, B_ALUMNI, or B_DONOR. Should I have an "ELSE" somewhere in the -DEFAULT maybe? So if it's unchecked = 'N' for No and checked = 'Y' for Yes?

@Wep5622: For those ALUMNI & DONOR fields, the output is either Y or N (Yes/No). I use the WHERE/IF button in the fex Report Painter and use the Assist button to select:
Column to Filter: TABLE.TABLE.COLUMN
Logical Relation: Equals
Compare Type: Parameter
Compare Value: '&COLUMN'


8009
Windows 7
Excel/HTML/AHTML/PDF
October 13, 2011, 05:42 PM
a415
I changed the report to have:
-SET &A_ALUMNI=IF &A_ALUMNI EQ ' ' THEN 'N' ELSE 'Y';
-SET &A_DONOR=IF &A_DONOR EQ ' ' THEN 'N' ELSE 'Y';
-SET &B_ALUMNI=IF &B_ALUMNI EQ ' ' THEN 'N' ELSE 'Y';
-SET &B_DONOR=IF &B_DONOR EQ ' ' THEN 'N' ELSE 'Y';

-DEFAULT &A_ALUMNI = ' '
-DEFAULT &A_DONOR = ' '
-DEFAULT &B_ALUMNI = ' '
-DEFAULT &B_DONOR = ' '

...
...
 
WHERE TABLE1.TABLE1.A_ALUMNI EQ '&A_ALUMNI';
WHERE TABLE1.TABLE1.A_DONOR EQ '&A_DONOR';
WHERE TABLE1.TABLE1.B_ALUMNI EQ '&B_ALUMNI';
WHERE TABLE1.TABLE1.B_DONOR EQ '&B_DONOR';


When I run the .fex by itself as an AHTML and leave any of the text boxes blank with any multiple of them entered as Y, the report works. Where I put the Y's, those get pulled - and any of them with blanks come up as N's. It ran quickly and looks great. Perfect, right?

However, when referencing the procedure from the HTML Composer with Control Types changed from 'Text box' to 'Check Box', it doesn't work. I set each check box to unchecked and 'Selection Required: No' - and have tested 'Default Selection: Yes' and 'Default Selection: No' for all for two separate test runs, it will say "Loading..." and then the report frame box goes blank and the corner of my IE window says "Done". But no output like when I ran the fex.

I assume this is due to the SET and DEFAULTs, but I can't think of how to say if the CHECK BOX is unchecked then N else Y. Any ideas? Smiler


8009
Windows 7
Excel/HTML/AHTML/PDF
October 13, 2011, 06:22 PM
Francis Mariani
If the checkbox is not selected, a blank parameter is passed. Then you use it in Dialogue Manager if you like:

quote:
-SET &SOMETHING = IF &CHECKBOXPARM EQ 'Y' THEN 'ABC' ELSE 'XYZ';



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 14, 2011, 05:34 PM
a415
@Francis: Just to confirm, do you mean:
-SET &ANYTEXT1 = IF &A_ALUMNI EQ 'N' THEN 'N' ELSE 'Y';
-SET &ANYTEXT2 = IF &A_DONOR EQ 'N' THEN 'N' ELSE 'Y';
?

The reason I ask is because I mainly do this through the GUI and I don't see a &CHECKBOXPARM option. I also don't know how to get the HTML to realize that unchecked = 'N'. Is there some javascript I would need to add, or is working in the GUI enough?

Sorry if my description is a bit confusing. I'm still learning WF and this is the first time I'm trying checkboxes. I tried the HELP files, but it shows me to click the Event Handler using an icon with a lightning bolt and I've checked every icon and don't see it.

I feel like I'm making this more complicated than this probably is Sweating


8009
Windows 7
Excel/HTML/AHTML/PDF
October 17, 2011, 08:15 PM
Anatess
Hi a415,

I'm not sure how familiar you are with HTML. Checkboxes work by assigning specific values for each option. So, if you look at your html code, you should see something like this:

<INPUT id=checkbox1_0 type=checkbox value=Y name=A_ALUMNI displaytext="Yes">


See that value= parameter? That dictates what gets passed to your fex in webfocus. You set those values in the Parameter tab of the HTML Layout Painter. If you would have had the No option where you have 2 checkboxes for the same variable (A_ALUMNI), you would see something like this:

<INPUT id=checkbox1_0 type=checkbox value=Y name=A_ALUMNI displaytext="Yes">
<INPUT id=checkbox1_1 type=checkbox value=N name=A_ALUMNI displaytext="No">


That gives you both options - a Y or N value passed because that's what you put as the value= on the checkboxes - that is, you assigned 2 values in the Parameter tab (it's an either/or, you can't check both).

The NAME= parameter tells you what & variable the values are going to go to.

But, since you only want 1 checkbox - the Yes box, then you only have 1 value that you passed to the focexec - and that's whatever value you put in the Parameter tab... I guess in your case you made it a Y. So, if you don't check the box, then you will get a null value. Now, the -DEFAULT in your fex is going to be over-ridden by the null value if you don't check a box.

So... in your focexec, you will then need to account for an unchecked value if you want that to mean No. Hence, Francis gave you a sample logic of how you can do this in the focexec. Basically, the idea is - if the value is passed (&A_ALUMNI=Y), then you got a YES, otherwise (any other value) you got a No.

Okay, so this makes more sense, I'll put a super generic HTML and Focexec here that you can use to practice on:

HTML:
<!-- Generated by Report Layout Painter -->
<HTML>
<HEAD>
<TITLE>HtmlPage</TITLE>
<BASE href=HTTPS://webreportsdev.ww007.siemens.net:443>
<META content="MSHTML 6.00.6000.21305" name=GENERATOR>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
UpdateData();
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto">
<IFRAME id=report1 title=checkbox.fex style="Z-INDEX: 1; LEFT: 10px; OVERFLOW: auto; WIDTH: 930px; POSITION: absolute; TOP: 170px; HEIGHT: 300px" tabIndex=1 name=report1 executebuttonId="form2Submit" requests_list="0" autoExecute="False" elementtype="2"></IFRAME>
<FORM id=form2 style="Z-INDEX: 2; LEFT: 10px; WIDTH: 930px; POSITION: absolute; TOP: 10px; HEIGHT: 153px" tabIndex=2 name=form2 onsubmit="OnExecute(this);return false;" method=post requests_list="0" fexlist_list="report1" default_slider_type="4" form_prompt_location="1" form_number_of_visible_rows="4" form_number_of_columns="4" vert_dist_between_controls="10" form_hor_dist_between_controls="10" form_dist_between_desc_and_input="10">
<INPUT id=form2Submit style="Z-INDEX: 3; LEFT: 800px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/run16.gif); WIDTH: 80px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 10px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=3 type=submit size=41 value=" " name=ITEM1>
<INPUT id=form2Reset style="Z-INDEX: 4; LEFT: 800px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/reset.gif); WIDTH: 80px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 40px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=4 type=reset size=41 value=" " name=reset1> 
<FIELDSET id=form2_formbodyid style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Z-INDEX: 5; LEFT: 5px; PADDING-BOTTOM: 0px; OVERFLOW: auto; WIDTH: 775px; BORDER-TOP-STYLE: none; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 5px; HEIGHT: 121px; BORDER-BOTTOM-STYLE: none" tabIndex=5 tempheight="121" tempwidth="520" formbody="1">
<SPAN id=pane1 style="Z-INDEX: 6; LEFT: 0px; WIDTH: 145px; POSITION: absolute; TOP: 0px; HEIGHT: 99px" tabIndex=6 elementtype="32" name="CHK_A">CHK_A
<SPAN id=checkbox1 contentEditable=false style="Z-INDEX: 7; LEFT: 0px; WIDTH: 145px; POSITION: absolute; TOP: 29px; HEIGHT: 26px" tabIndex=7 name="CHK_A" defaultlocation="29,0,99,117" addalloption="0" accept="0" operation="NONE" selectedvalue="N" datasource boundtovariable="1" requiredfield="1498338" datatype="0" sourcetype="typeMaster" columns="1"> 
<TABLE contentEditable=false style="WIDTH: 100%; HEIGHT: 100%" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<INPUT id=checkbox1_0 type=checkbox value=Y name=CHK_A displaytext="Yes">
<LABEL style="CURSOR: default" tabIndex=7 for=checkbox1_0>Yes</LABEL></TD></TR></TBODY></TABLE></SPAN></SPAN>
<SPAN id=pane2 style="Z-INDEX: 8; LEFT: 175px; WIDTH: 158px; POSITION: absolute; TOP: 0px; HEIGHT: 99px" tabIndex=8 elementtype="32" name="CHK_B">CHK_B
<SPAN id=checkbox2 contentEditable=false style="Z-INDEX: 9; LEFT: 0px; WIDTH: 117px; POSITION: absolute; TOP: 29px; HEIGHT: 70px" tabIndex=9 name="CHK_B" defaultlocation="29,0,99,117" addalloption="0" accept="0" operation="NONE" selectedvalue="N" datasource boundtovariable="1" requiredfield="1498338" datatype="0" sourcetype="typeMaster" columns="1"> 
<TABLE contentEditable=false style="WIDTH: 100%; HEIGHT: 100%" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<INPUT id=checkbox2_0 type=checkbox value=N name=CHK_B displaytext="No">
<LABEL style="CURSOR: default" tabIndex=9 for=checkbox2_0>No</LABEL></TD></TR>
<TR>
<TD>
<INPUT id=checkbox2_1 type=checkbox value=Y name=CHK_B displaytext="Yes">
<LABEL style="CURSOR: default" tabIndex=9 for=checkbox2_1>Yes</LABEL></TD></TR></TBODY></TABLE></SPAN></SPAN>
<SPAN id=pane3 style="Z-INDEX: 10; LEFT: 365px; WIDTH: 170px; POSITION: absolute; TOP: 0px; HEIGHT: 99px" tabIndex=10 elementtype="32" name="CHK_C">CHK_C
<SPAN id=checkbox3 contentEditable=false style="Z-INDEX: 11; LEFT: 0px; WIDTH: 117px; POSITION: absolute; TOP: 29px; HEIGHT: 70px" tabIndex=11 name="CHK_C" defaultlocation="29,0,99,117" addalloption="0" accept="0" operation="NONE" selectedvalue="N" datasource boundtovariable="1" requiredfield="1498338" datatype="0" sourcetype="typeMaster" columns="1"> 
<TABLE contentEditable=false style="WIDTH: 100%; HEIGHT: 100%" cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD>
<INPUT id=checkbox3_0 type=checkbox CHECKED value=N name=CHK_C displaytext="No">
<LABEL style="CURSOR: default" tabIndex=11 for=checkbox3_0>No</LABEL></TD></TR>
<TR>
<TD>
<INPUT id=checkbox3_1 type=checkbox value=Y name=CHK_C displaytext="Yes">
<LABEL style="CURSOR: default" tabIndex=11 for=checkbox3_1>Yes</LABEL></TD></TR></TBODY></TABLE></SPAN></SPAN></FIELDSET></FORM>
<xml id=ibi_requests>
<script>
<requests>
<request requestid="0" targettype="iframe" targetname="report1" sourcetype="typeFex" ibif_ex="checkbox.fex" ibic_server="EDASERVE" ibiapp_app="baseapp" activereport="0" reportcolumns="">
<variables>
<variable field="CHK_A" file="" desc="CHK_A" datatype="0" operation="" default="N" name="CHK_A" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>
<variable field="CHK_B" file="" desc="CHK_B" datatype="0" operation="" default="N" name="CHK_B" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>
<variable field="CHK_C" file="" desc="CHK_C" datatype="0" operation="" default="N" name="CHK_C" textvarname="" accept="0" type="default" select="0" min="" max="" controltype="7" create="1"></variable>
</xml></BODY></HTML>


Focexec:
-* File checkbox.fex
-DEFAULT &CHK_A='N';
-DEFAULT &CHK_B='N';
-DEFAULT &CHK_C='N';

-? &CHK


Play with those values and see if this would start to make some sense. Hope this helps.


WF 8.1.05 Windows
November 09, 2011, 05:26 PM
a415
Thank you!!! Big Grin


8009
Windows 7
Excel/HTML/AHTML/PDF