mrc
Documentation
michaels, ross &
cole, ltd.
http://www.mrc-productivity.com/
|
|
Reports: Avoid Entering Duplicate Run-Time Report Selections
Here is
the situation...
Let's say I've built a report for our bike distributor, crazybikes.com, for
users to learn how much specific customers have spent on each product class
(Bicycles, Accessories, Athletic Wear, etc) at this point in the month.
My selection of records is based on the Customer Number, the Month-to-Date
(MTD) Sales Dollars, and the Product Class. At runtime, I want the user to
input the Customer Number and an amount for MTD Sales Dollars. But for the
Product Class, I want it to be hard-coded in the selection criteria as either
100 (bicycles) or 200 (accessories).
In order to get the correct information in the report I'll need to repeat the
selection for the Customer Number and Month to Date Sales for each Product
Class I want. So, the logic of my selection criteria would be the following:

...which would result
in the following the report prompt page:

As you can see, the
user will then be forced to enter the selections for Customer Number and MTD
Sales Dollars multiple times, even though the values will be the same. This
might be tedious to the user and it may also confuse them. So, I suggest making
a few minor changes in the HTML of the report prompt page (Rxxxxxs.html) to
avoid this problem. Where I'll hide the duplicate prompts, but also pass the
values entered from the previous prompts for Customer Number and MTD Sales
Dollars to them.
Step 1:
Insert the JavaScript "getvalue" function, which is displayed below.
You can add it directly after the </head> tag, which is towards
the top of the HTML page.
<script language="JavaScript">
function getvalue(){
document.FORM_R12050.R003.value=document.FORM_R12050.R001.value;
document.FORM_R12050.R004.value=document.FORM_R12050.R002.value;
}
</script>
NOTE: You will have to make changes to this JavaScript to fit your
application. Where you see R12050, which is my report number, you'll
have to replace that with yours. Secondly, our naming convention for the
runtime values is; R001 for first runtime field, R002 for the
second, R003 for the third, R004 for the fourth, and so on. So,
in my JavaScript I set R003 (my duplicate Customer Number prompt) to
retrieve the value entered into R001 (First Customer Number prompt). And I did
the same for R004 (duplicate MTD Sales Dollars prompt), where it
retrieves the value entered into R002 (First MTD Sales Dollars prompt)
Step 2:
Change the below line to include onSubmit="getvalue();"
From:
<form name="FORM_R12050" method="POST"
ACTION="F_ACTSTR">
To:
<form name="FORM_R12050" method="POST"
ACTION="F_ACTSTR" onSubmit="getvalue();">
Step 3:
In this step, you need to hid the duplicate selection prompts from the page but
still make them available to accept the values being passed. In the table
section of your HTML, comment-out the lines displaying the duplicate selection
prompts. Then, copy the lines below (in bold) for each runtime prompt
and place it directly above what you just commented-out.
So your result looks like this:
<input size=6 type="hidden" name=R003
value="F_R_SI_R003">
<input size=6 type="hidden" name=R004
value="F_R_SI_R004">
(Note: You need to make one change, replace "text" with
"hidden")
<!-- <tr>
<td align="left" class="ten"><strong>Customer
Number </strong>
Equal to </td>
<td class="ten"><input size=6 type="text"
name=R003 value="F_R_SI_R003">
And
<font color="red">F_V_EN_R003</font></td>
</tr>
<tr>
<td align="left" class="ten"><strong>Month to
Date Sales - Dollars </strong>
Greater than </td>
<td class="ten"><input size=9 type="text"
name=R004 value="F_R_SI_R004">
<font color="red">F_V_EN_R004</font></td>
</tr>
</tr>
-->
Step 4:
And that's it! When you run your report the prompt page will look like this:

Additional Notes:
You may want change your output for your report to not include the selection
criteria values you hid in your prompt page. To do that change the report
output (Rxxxxx.html) by commenting-out those lines, which are the in the <!--
Begin Run Time Selection Table --> section of the HTML. Below, in bold,
is what I commented out.
<!-- Begin Run Time Selection Table -->
<table border="0" cellspacing="0"
cellpadding="2" class="collapse">
<tr><th colspan="3">Selection
criteria</th></tr>
<tr><td class="ten">Customer Number Equal to </td>
<td class="ten">F_R_SD_R001 </td>
<td class="ten">And </td>
</tr>
<tr><td class="ten">Month to Date Sales - Dollars Greater
than </td>
<td class="ten">F_R_SD_R002 </td>
<td class="ten">And </td>
</tr>
</tr>
<!-- <tr><td class="ten">Customer Number Equal to
</td>
<td class="ten">F_R_SD_R003 </td>
<td class="ten">And </td>
</tr>
<tr><td class="ten">Month to Date Sales - Dollars Greater
than </td>
<td class="ten">F_R_SD_R004 </td>
<td class="ten"> </td>
</tr>
</tr>
--> </table>